[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Condor-devel] How to revert a merge to the master
- Date: Mon, 26 Apr 2010 11:06:13 -0500
- From: Greg Thain <gthain@xxxxxxxxxxx>
- Subject: [Condor-devel] How to revert a merge to the master
All:
Git makes it easy to push a change, to revert a change, and to merge
branches together. We've discovered, though, that reverting a merge is
tricky. Actually, reverting a merge is trivial, but it leads to some
surprising side effects. To wit: if you merge branch B onto the
Master, and release that you shouldn't have, you can revert the merge on
the master with git revert. Everything is fine at that point. However,
if you subsequently fix whatever was wrong on the branch, and re-merge,
the only commits that get merged are the ones from after the revert.
This is because the master and the branch have a common sha-1 right
before the revert, and the 2nd merge only goes back to there.
I was talking to some friends of mine this weekend with this problem,
and here's what they do. It's a bit convoluted, but you end up with
what you want.
If you merge a branch to the master, and discover there's a problem,
first, revert the merge on the master. Then (and here's the trick),
merge the (reverted) master, back to the branch. Finally, revert the
revert on the branch. This leaves the master in the "before" condition,
the branch in the after state, and with the common point where you want
it. This way, when you fix the branch, and go to merge it in again,
everything you want merged from the branch will go into the master.
Did anyone follow that?
_Greg