git undo merge before merge code example Example 1: git merge cancel git merge --abort Example 2: revert last merge git git revert -m 1 commit_hash