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