reset commit before push code example Example 1: cancel a commit not pushed git reset --soft HEAD~ Example 2: undo commit git before push git reset HEAD~