undo commit
# KEEP CHANGES
git reset --soft HEAD~1
# REMOVE CHANGES
git reset --hard HEAD~1
Lively Leopard
# KEEP CHANGES
git reset --soft HEAD~1
# REMOVE CHANGES
git reset --hard HEAD~1
# Uncommit the changes
git reset --soft HEAD~1
# Completely delete the changes
git reset --hard HEAD~1
$ git reset --soft HEAD~1
$ git reset --hard HEAD~1
$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~ # (1)
[ edit files as necessary ] # (2)
$ git add . # (3)
$ git commit -c ORIG_HEAD # (4)
If your commits are only LOCAL,
you can git reset --hard origin/<branch_name>
to move back to where the origin is.