Git Reset: Undo Commits (Soft, Mixed, or Hard)

Suman SharmaSuman Sharma

Git Reset: Undo Commits (Soft, Mixed, or Hard)

git reset moves your branch pointer backward.

The important part is choosing what happens to your files afterward.

Using git reset to undo commits

The three modes

git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
ModeCommit undoneStaging keptWorking files kept
--softyesyesyes
--mixedyesnoyes
--hardyesnono

Next

If you reset too far and panic:

Contact

Get in Touch

Want to call me? book a call and I'll respond in the available time slot. I will ignore all soliciting.