Mercurial 摆脱糟糕的合并
我刚刚将分支 A 合并到 B 中,由于某种原因合并进展不顺利。我想将 B 恢复到合并之前的位置,然后重试,就像以前从未发生过一样。我正在考虑
hg clone myrepo newrepo -r A -r 12345
在 B 的错误合并提交之前执行 12345 是修订号的操作,
我认为这可行,但我有很多其他分支(其中大多数是使用 commit --close-branch 关闭的),这会将这些分支放回去到非活动状态。
有没有办法克隆除修订版 123456 之外的所有内容? (其中 123456 是 B 上的错误提交)
I just merged branch A into B, and for some reason the merge did not go well. I want to revert B back to where it was before the merge and try again like it never happened before. I was thinking of just doing
hg clone myrepo newrepo -r A -r 12345
where 12345 is the revision number before B's bad merge commit
I think this works, but I have a lot of other branches (most of which are closed using commit --close-branch) and this puts those branches back to an inactive state.
Is there a way to clone everything except revision 123456 or something? (where 123456 is the bad commit on B)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
假设您尚未将合并变更集推送到任何公共位置,最简单的解决方案是使用 Mercurial Queues(即
mq
)扩展附带的hg strip
命令。来自 wiki:
Assuming you have not pushed the merge changeset to any public location, the easiest solution is to use the
hg strip
command that comes with the Mercurial Queues (i.e.mq
) extension.From the wiki:
它可能不如 hg 回滚那么好,但通常我所做的就是更新到头 A,合并之前的头 B,检查这次是否正确,然后 虚拟合并 消除错误的合并。
It might not be as nice as hg rollback, but usually what I do is update to head A, merge in previous head B, check that I got it right this time, and then dummy-merge away the bad merge.
我希望我正确理解你的情况。如果是的话,您应该能够在合并之前更新到 B 的修订版,为该修订版指定一个新的分支名称,将 A 合并到其中,然后继续。您可能希望将原始 B 分支标记为已关闭。
I hope I'm understanding your situation correctly. If I am you should be able to update to the revision of B before the merge, give that revision a new branch name, merge A in to it, and continue on. You'll probably want to mark the original B branch as closed.
现在使用 hg rollback 命令是否太晚了?如果是这样,请尝试 hg backout 命令。
Is it too late to use the hg rollback command? If so, try the hg backout command.