# Undo the last commit but keep changes staged
git reset --soft HEAD~1
# Undo the last commit and unstage files (but keep changes)
git reset --mixed HEAD~1
# Completely remove last commit and discard changes
git reset --hard HEAD~1