git undo last commit local and remote code example Example: git undo last commit $ git reset --soft HEAD~1