Reverting a merge request is easy, provided you are abandoning the branch and do not want to fix it up for a later merge. If so you should read:
https://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt
Bottom line is, it is tricky. The simplest method would seem to be alluded to near
the bottom, which is to force a rebase against the branch point with -no-ff
in
effect. This rewrites the branch history (changes the SHAs) so that the commits
are not known in the reverted branch. As Linus says:
Let's revisit the situation discussed at the start of this howto:
P---o---o---M---x---x---W---x
\ /
A---B---C----------------D---E <-- fixed-up topic branch
At this point, you can use --no-ff to recreate the topic branch:
$ git checkout E
$ git rebase --no-ff P
yielding
A'---B'---C'------------D'---E' <-- recreated topic branch
/
P---o---o---M---x---x---W---x
\ /
A---B---C----------------D---E
You can merge the recreated branch into the mainline without reverting commit W,
and mainline's history will look like this:
A'---B'---C'------------D'---E'
/ \
P---o---o---M---x---x---W---x---M2
\ /
A---B---C
The other take home message is that merge reverts are not the same as a commit revert. A merge revert undoes the changes of the commits, not the commits. So the commits remain and when you attempt to merge are assumed already done as the SHAs match.