Return merge effect "discard all changes"

Suppose that it was merged with the option "Discard all changes from the merge ...", "Crash".

And this error was fixed in the "central" repository.

How to deal with this case, if I need to merge the branch correctly?

Commands for playing a case:

hg init mr cd mr echo "123" > file.txt hg add hg ci -m "initial" hg branch br echo "234" >> file.txt hg ci -m "in branch" hg up default echo "567" >> file.txt hg ci -m "in default" 

After these commands open tortoisehg and salt the 2nd revision (default head) with the br branch with the option "Cancel ...".

UPD

This is a question about how to do the opposite. How to merge to get rid of the head using the Mercurial command line, how can I do with TortoiseHg? ;)

But still I can’t find a way to return this step: - (

+4
source share
1 answer

One way is to repeat the merge and make another merge by dropping.

In your example, update the second version (the current parent of the working directory before you failed the merge), then repeat the merge with this other branch. Do it right this time.

This will give you one more chapter.

Then merge with the old, incorrect merge and select "Cancel". You have now effectively circumvented this merge with the right one.

If you are not sure about the steps, create a local clone and experiment, you can always just drop it and put it off and try again.

Version 3 is an old wrong merge in which I chose reset. After merging 4 and 5, the traces of this merge disappear, and everything returns to working mode. Yes, the story looks a little scared, but believe me, the cleaning procedures to completely get rid of this bad merge are much worse than the little hickup on your story timeline.

Basically you have this scenario after a failed merge:

  +-- botched merge v 0---2---3 \ / 1---+ 

So, you update the parent folder of the working folder before a bad merge and do another merge this time. Now it looks like this:

  +-- botched merge v 0---2---3 \ \ / \ x 1-+-4 ^ +-- good merge 

Now your working folder is in edition 4, so you do another merge, this time with version 3 (bad merge) and decide to abandon these changes, and you will get the following:

  +-- botched merge v 0---2---3-5 <-- final merge, discard 3 \ \ / / \ x / 1-+-4 ^ +-- good merge 

Here, as TortoiseHg shows this:

history after new merges

+2
source

All Articles