Merge revert

Sean Farley sean at farley.io
Tue Oct 4 21:55:28 UTC 2016


Steve - Gadget Barnes <gadgetsteve at hotmail.com> writes:

> On 04/10/2016 07:21, Nicolas Pinault wrote:
>> Le 04/10/2016 à 03:40, Andrew Taumoefolau a écrit :
>>> Have further commits been made on top of the branch merge?
>> Yes. Commits on both branches.
>>>> On 4 Oct. 2016, at 1:22 am, Nicolas Pinault <nicolasp at aaton.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I accidentally merged 2 branches. Before I realize it I committed changes and pushed to the server.
>>>> When I try to backout the merge node, I get : "abandon : cannot backout a merge changeset"
>>>> What is the best way to correct this error ?
>>>>
>>>> Nicolas
>
>
> If you type `hg help backout` you will see, about half way through, the
> phrase "Note:  'hg backout' cannot be used to fix either an unwanted or
> incorrect merge."
>
> So this could be your issue!
>
> AFAIK the only solution would be to use hg convert to export all of the
> history prior to the erroneous merge, use patches to capture and apply
> the changes after it and apply them to the converted repository and
> switch out the old repository and the new one.  You will have to inform
> all of your co-workers a) Not to commit anything while this is in
> progress & b) to clone the new repository to a new area and apply any
> uncommitted changes that they have to the new repository.

What? No, please don't jump to 'hg convert' so soon. I'm about to board
an international flight so don't have too much time to respond but here
are some quick tips in order of difficulty:

1) (the safest) is to use graft to apply the children of the merge
commit to before the merge and then mark the unwanted work as closed via
'hg commit --close'

2) you could use a combination of 'hg strip' (which requires every clone
and the server to do the same)

3) you could try evolution (if all the clients and server support it)

Hopefully this is enough for you to go on.



More information about the Mercurial mailing list