How to get rid of a bad branch merge?
Kevin Bullock
kbullock+mercurial at ringworld.org
Sat Aug 31 04:24:34 UTC 2013
On 29 Aug 2013, at 4:36 PM, Steven wrote:
> Say I have 3 branches, A, B, and C
>
> C contains merges from branch A, and A contains merges from C.
>
> If someone accidentally merge B into A, we can no longer merge A and C because they will have to essentially merge part of B and C. In addition, if we merge A into C and use C's version when resolving conflicts with B, if someone else tries to merge B into C later on, mercurial will notice part of B is already merged into C, and ignore those changes.
>
> Is there a way to remove that troublesome merge? I tried creating a new branch and rebasing (have to redo all the merges in A again), hg prune (evolve doesn't support merges yet), graft/transplant (doesn't really work with merges).
Use `hg clone -r REV` to get a new copy of the repo without the bad merge. In your case, you could do something like `hg clone -r 'p1(A)' -r B -r C the-repo the-copy`. Note this assumes the head of A is the bad merge -- if that's not the case, find the ID of the bad merge and do 'p1(ID)'.
See also: <http://mercurial.selenic.com/wiki/EditingHistory> if you can beat out the wiki spammers in getting it to load. (We're working on it. :/)
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
More information about the Mercurial
mailing list