Mercurial 无操作合并以保留历史记录和数据关闭分支
替代文本 http://img38.imageshack.us/img38/1863/screenshot20091218at112.png< /a>
修订版 107 意外合并了 100-106 版的所有更改
修订版 108 是 hg revert --all -r 106,然后是 hg commit,这可能是错误的做法,因为我没有合并我所在的分支进行了所有更改后,我已将所有更改包含在一个更改集中,没有任何描述或历史记录。
A)我首先应该如何合并分支?
但更重要的是:
B)我现在如何合并分支?
alt text http://img38.imageshack.us/img38/1863/screenshot20091218at112.png
Revision 107 accidentally merged away all the changes from 100-106
Revision 108 was a hg revert --all -r 106, followed by hg commit, which was probably the wrong thing to do, since instead of merging the branch where I made all the changes, I've encompassed all the changes into one changeset with no description or history.
A) How should I have gone about merging the branch in the first place?
But more importantly:
B) How do I go about merging the branch now?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您尚未将存储库从您的盒子中推送到任何地方,您可以轻松修复:
现在
newcurrent
是一个看起来与 107 和 108 发生之前的旧存储库一模一样的存储库。要合并这两个,只需执行以下操作:
尚不清楚您在创建 107 时做错了什么,所以我不知道如何建议在实践中进行更改,但这应该是一个简单的合并问题。意外地消除一个分支中的所有更改应该是一件困难。
If you've not yet pushed the repo anywhere off your box you have an easy fix:
now
newcurrent
is a repo that looks exactly like your old one did before 107 and 108 happened.To merge those two, just do:
It's not clear what you did wrong in creating 107, so I don't know how to suggest a change in practice, but it should be a simple matter of merging. Accidentally eliminating all the changes in one branch should have been hard.
如果可能的话,备份存储库,以便您可以安全地进行实验。
此命令将撤消最后一个事务:
此命令可能会帮助您撤消合并和恢复:
此命令会将您的工作目录恢复到以前的状态而不影响存储库:
每种情况下的 -h 选项都会为您提供该命令的帮助。当您准备好应用该命令时,请删除 -h 选项。
我的第一个实验是:
计划回到修订版 107,它看起来像是包含变更集 95 和 96 的头的成功合并,然后合并包含变更集 97、100 - 106 的头。
If at all possible, back-up the repository, so that you can experiment safely.
This command will undo the last transaction:
This command might help you to undo your merge and revert:
This command will recover your working directory to a previous state without affecting the repository:
The -h option in each case gives you the help for the command. Remove the -h option when you are ready to apply the command.
My first experiment would be:
The plan being to get back to revision 107, which looks like a successful merge of the head containing changesets 95 and 96, and then to merge in the head containing changesets 97, 100 - 106.