How to undo the last local commit code example Example: git undo last commit $ git reset --soft HEAD~1