Oh, reverting merges! I've been there, and it is completely possible, out of the box, with git. But! It requires a relatively thorough understanding of how it works, or you will definitely mess it up. I wrote up this summary a while back for our company wiki:
Imagine this scenario:
- Team Sandy does a ton of work on branch foo.
- Team Sandy ensures the release manager that branch foo is perfect and bug free.
- Team Sandy merges branch foo into branch develop and pushes.
- Other developers continue committing to develop.
- Massive devastation and destruction start occurring due to massive bugs scattered throughout Sandy's code.
At this point, we want to get all of Sandy's code out of develop, as we can't post to production until develop is Sandy-free. What do we do?
- Revert the merge commit
The important thing to note here is that this basically undoes the effect of the merge, but NOT the history. If you were to try to merge branch foo back in at a later date, git would do nothing and tell you that everything is already merged in. This is technically correct, but confusing.
Let's imagine that Sandy goes back to branch foo and commits bug fixes to fix the devastation. Now, branch foo is ready to be merged back in. What do we do?
- Revert the revert commit (yes, really). This basically undoes the effect of our original undo. At this moment, develop has all of branch foo's code pre-bug fixes.
- Merge foo into develop. This merges the subsequent bug fix commits into develop.
A much more thorough discussion can be enjoyed here (I highly recommend the read): https://www.kernel.org/pub/software/scm/git/docs/howto/rever...
--
Basically, it can be done with one line on the commandline, but I wouldn't recommend anyone do it unless they've read the above (specifically, the discussion I've linked to).