Mercurial 无操作合并以保留历史记录和数据关闭分支

发布于 2024-08-15 12:40:50 字数 410 浏览 3 评论 0原文

替代文本 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏日浅笑〃 2024-08-22 12:40:50

如果您尚未将存储库从您的盒子中推送到任何地方,您可以轻松修复:

   cd ..
   hg clone -r 106 current newcurrent
   cd newcurrent
   hg pull -r 97 ../current

现在 newcurrent 是一个看起来与 107 和 108 发生之前的旧存储库一模一样的存储库。

要合并这两个,只需执行以下操作:

   hg update  # which gets you to tip
   hg merge   # which merges in the other head and forces you to make choices

尚不清楚您在创建 107 时做错了什么,所以我不知道如何建议在实践中进行更改,但这应该是一个简单的合并问题。意外地消除一个分支中的所有更改应该是一件困难。

If you've not yet pushed the repo anywhere off your box you have an easy fix:

   cd ..
   hg clone -r 106 current newcurrent
   cd newcurrent
   hg pull -r 97 ../current

now newcurrent is a repo that looks exactly like your old one did before 107 and 108 happened.

To merge those two, just do:

   hg update  # which gets you to tip
   hg merge   # which merges in the other head and forces you to make choices

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.

半透明的墙 2024-08-22 12:40:50

如果可能的话,备份存储库,以便您可以安全地进行实验。

此命令将撤消最后一个事务:

hg rollback -h

此命令可能会帮助您撤消合并和恢复:

hg backout -h

此命令会将您的工作目录恢复到以前的状态而不影响存储库:

hg revert -h

每种情况下的 -h 选项都会为您提供该命令的帮助。当您准备好应用该命令时,请删除 -h 选项。

我的第一个实验是:

hg rollback
hg merge -r 106

计划回到修订版 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:

hg rollback -h

This command might help you to undo your merge and revert:

hg backout -h

This command will recover your working directory to a previous state without affecting the repository:

hg revert -h

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:

hg rollback
hg merge -r 106

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文