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