Interview Prep/Git & GitHub/Merge, rebase and cherry-pick

How do you undo a merge that is already pushed?

AdvancedConceptMerge, rebase and cherry-pick
Answer

Do not reset shared history. Revert the merge commit by naming which parent is the mainline, and note that re-merging the same branch later will not bring its changes back unless you first revert the revert.

git revert -m 1 <merge-sha>
# later, to re-merge the branch:
git revert <revert-sha>
All Git & GitHub questions Roadmap: Git & GitHub

More on Merge, rebase and cherry-pick