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