如何中止 Mercurial 中的合并?
我搞砸了合并。我想恢复然后重试。
有没有办法在提交之前恢复合并?
hg revert
没有做我想要的事情,它只恢复文件的文本。 Mercurial 中止了我的第二次合并尝试,并抱怨原始合并仍未提交。
有没有办法在 hg merge 命令之后但提交之前撤消合并?
I goofed up a merge. I'd like to revert then try again.
Is there a way to revert a merge before it is committed?
hg revert
doesn't do what I'd like, it only reverts the text of the files. Mercurial aborts my second attempt at merging and complains original merge is still uncommitted.
Is there a way to undo a merge after an hg merge
command but before it's committed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
hg update -C <两个合并变更集之一>
hg update -C <one of the two merge changesets>
在执行
hg merge
之后,但在hg commit
之前,您的工作副本有两个父级:第一个父级是您在合并之前更新的变更集,第二个父级是您要合并的变更集。只要您的工作副本有两个父副本,Mercurial 就不会让您再次执行hg merge
操作。对于如何继续,您有两种选择:
如果您想中止合并并返回到开始的位置,请执行以下操作
这将更新工作副本以匹配第一个父级:
。
始终表示工作副本的第一个父级。如果您想重新合并一些文件,那么就这样做
这将重新启动合并工具,就像您执行
hg merge
时一样。如果您在hg merge
时发现您的合并工具配置错误,则resolve命令很有用:修复配置并运行hg resolve --all
。您可以根据需要多次运行hg resolve
,直到您对合并感到满意为止。After you do
hg merge
, but beforehg 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 dohg merge
again as long as your working copy has two parents.You have two options on how to proceed:
If you want to abort the merge and get back to where you started, then do
This will update the working copy to match the first parent: the
.
always denotes the first parent of the working copy.If you want to re-merge some files then do
This will re-launch the merge tools just as when you did
hg merge
. The resolve command is good if you find out athg merge
-time that your merge tools are configured badly: fix the configuration and runhg resolve --all
. You can runhg resolve
as many times as you want until you are satisfied with the merge.今天有
hg merge --abort
。请参阅hg 帮助合并
。Today there is
hg merge --abort
. Seehg help merge
.