Skip to content


Undo Add#

The opposite instruction of add (staging files) is reset (unstaging files). Use git reset FILE to just unstage FILE or git reset to unstage everything.


git add
git reset

Undo Commit#

To undo the last commit without resetting the worktree and index use git reset --soft HEAD^ which is equivalent to git reset --soft HEAD~1


git commit -m "Add something"
git reset --soft HEAD^
git commit -a -c ORIG_HEAD

Soft vs. Mixed vs. Hard Reset#

uncommit changes, changes are left staged (index).
--mixed (default)
uncommit + unstage changes, changes are left in working tree.
uncommit + unstage + delete changes, nothing left.


Last update: January 14, 2021
Authors: Marvin Elsen