how to remove merge changes in git code example Example 1: git undo merge git reset --hard HEAD~1 Example 2: revert last merge git git revert -m 1 commit_hash