How do you easily unmerge a topic branch in Subversion/git?

Viewed 1687

So I have /trunk, to which all things golden are eventually committed. And I have a topic branch, /topicA.

Normally, you would merge /topicA into trunk and it would be one commit. Hooray! To undo this merge, you just have to reverse merge the commit caused by this merge. Easy peasy.

Now, let's say I have /topicA and I merge it into /trunk... But then I have a bugfix that relates to /topicA. So, should I be committing to /topicA again? I can even remerge /topicA so that /trunk contains /topicA. But how to I rollback all of /topicA, original work AND bugfixes, easily?

Commit history:

  • Commit to /topicA
  • Commit to /topicA
  • Commit to /topicA
  • ...
  • Merge /topicA into /trunk
  • ...
  • Bugfix1 to /topicA
  • Remerge /topicA into /trunk for bugfixes
  • ...
  • Bugfix2 to /topicA
  • Bugfix3 to /topicA
  • Remerge /topicA into /trunk for bugfixes
  • ...
  • ??? (unmerge /topicA, bugfixes included)

I know you can just unmerge each bugfix and then the initial merge, but that doesn't seem sexy at all.

Does git have an answer to this as well?

6 Answers
Related