Really undo bad merge

Tim Schmielau hg at chmielau.orangehome.co.uk
Wed Sep 28 11:41:28 UTC 2011


Laurens Blankers <Blankers <at> riscure.com> writes:

> I have a situation in which two branches were merged to soon. So
> I would like to undo the merge in such as way that I am able to
> redo the merge at a later stage.
>  
> Basically the Wiki describes my situation exactly:
> http://mercurial.selenic.com/wiki/Backout
>  
> However in the final step (the black box to the far right) I would 
> like the result to be "a b c X Y Z".

I'm not sure I fully understand your situation, but here
is how I would handle a bad merge:

 Suppose I had merged two branches and developed further on
 top of that:

  a -> ab -> abxy -> abxyz
         /
  x -> xy

 Now I discover the merge was bad, so I redo it:

  a -> ab -> abxy -> abxyz
         /\
  x -> xy  -> abXY

 To instruct mercurial that this merge is better than the
 previous one, I pro forma merge it again with the old,
 bad merge, always choosing the version from the good merge:

  a -> ab -> abxy -> abxyz
         /\       \       
  x -> xy  -> abXY -> abXY

 Now I can merge with everything developed on top of the
 bad merge without risking to reintroduce the bad changes:

  a -> ab -> abxy -> abxyz
         /\       \        \
  x -> xy  -> abXY -> abXY  -> ab XYZ

Would this method apply to your problem?
Tim




More information about the Mercurial mailing list