git how to undo a commit from local repo code example Example: undo local commit $ git reset --soft HEAD~1