Threre are multiple resources that will tell you how to revert a branch merge in git in case you figured out a bug in the branch. The steps following such a merge will either be reset/correct errors in branch/merge if the branch wasn't pushed upstream, or revert/correct errors in branch/revert the revert/merge. However, this only relates to the situation when there was an error in the branched code. Today I tried to revert a merge that was invalid because of the way conflicts were solved in the merging commit.
The situation before:
master o -- 1 -- C
\ /
branch a -- b
The developer that merged the branch into master encountered commits related to the code implemented by someone else in commit 1. He resolved the conflicts and committed them, thus creating a merging commit "c". The problem was that he introduced a bug while doing that. What I wanted to do then was to revert this merge and re-merge it properly, creating something that looks like this:
master o -- 1 -- C -- ~C -- C1
\ / /
branch a -- b ----------
Where "~C" is the reverted "C" and "C1" a correct merge. Unfortunately it looks like I can't do this.
Of course resetting to 1 and re-merging "branch" into "master" works, but the changes were already upstream and I didn't want to do any dirty tricks.
Solutions I found in thread Undo a Git merge that hasn't been pushed yet didn't take me anywhere.
The cleanest idea I got was to just fix the code broken in "C" and commit them to "master" but in this case you get no help from git, such as a list of conflicting files or highlighted conflicting lines, which in this case was very helpful.
Any ideas?