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>
More on Merge, rebase and cherry-pick
What is the difference between a fast-forward merge and a merge commit?BeginnerHow does a three-way merge work?IntermediateWhat does `git rebase` actually do?IntermediateMerge versus rebase: how do you decide?IntermediateWhat are squash merge, merge commit and rebase-and-merge on GitHub?IntermediateWhy does a squash-merged branch show as unmerged to `git branch --merged`?Intermediate