git undo last commit from branch code example Example: git undo last commit $ git reset --soft HEAD~1