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.

The three modes
git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
| Mode | Commit undone | Staging kept | Working files kept |
|---|---|---|---|
--soft | yes | yes | yes |
--mixed | yes | no | yes |
--hard | yes | no | no |
Next
If you reset too far and panic: