how to remove last commit in git terminal code example Example: git undo last commit $ git reset --soft HEAD~1