undo the merge in git code example
Example 1: undo a git merge
git reset --hard HEAD~1
git reset --hard <commit_sha>
Example 2: cancel a merge git
git merge --abort
Example 3: revert last merge git
git revert -m 1 commit_hash
git reset --hard HEAD~1
git reset --hard <commit_sha>
git merge --abort
git revert -m 1 commit_hash