如何终止汞合并?

我搞砸了一次合并,我想恢复然后再试一次。
有没有办法在提交合并之前恢复它?

hg revert不做我想做的事情,它只是还原文件的文本。Mercurial 中止了我的第二次合并尝试,并抱怨原始合并仍未提交。

有没有办法在 hg merge命令之后但提交之前撤消合并?

32066 次浏览

hg update -C <one of the two merge changesets>

After you do hg merge, but before hg commit, your working copy has two parents: the first parent is the changeset you had updated to before the merge and the second parent is the changeset you are merging with. Mercurial will not let you do hg merge again as long as your working copy has two parents.

You have two options on how to proceed:

  1. If you want to abort the merge and get back to where you started, then do

    hg update -C .
    

    This will update the working copy to match the first parent: the . always denotes the first parent of the working copy.

  2. If you want to re-merge some files then do

    hg resolve fileA fileB
    

    This will re-launch the merge tools just as when you did hg merge. The resolve command is good if you find out at hg merge-time that your merge tools are configured badly: fix the configuration and run hg resolve --all. You can run hg resolve as many times as you want until you are satisfied with the merge.

Today there is hg merge --abort. See hg help merge.