且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将两个Mercurial仓库合并为一个仓库

更新时间:2021-09-01 05:34:48

正如布兰登所说,只需将其从分支存储库推到主干,或将分支拉入主干即可.

As Brandon says, just push from the branch repo to the trunk, or pull the branch into the trunk.

然后,您可以选择是否要合并分支&将它们放在一起或分开放置.如果从分支推到主干,则可能会收到有关多个头的警告.如果要将它们分开,只需执行push -f. (拉动可能不会发出警告)

You can then choose if you want to merge branch & trunk together, or keep them separate. If you push from branch to trunk, you may get a warning about multiple heads. Just do a push -f if you want to keep them separate. (pull may not give a warning)

您可以将分支更改合并到主干,并且以后仍然可以在分支上做进一步的工作.总的来说,我会标记每个发行版,这样我就可以轻松返回到发布的所有内容.

You can merge the branch changes to the trunk and still be able to do further work on the branch later if you want. In general, I tag every release so I can easily get back to anything that went out the door.

创建分支时,是否将其克隆到另一个目录?如果是这样,将分支拉入中继仓库后将很难找到分支.您可能需要阅读书签来标记分支.另请参阅多个头如何工作.

When you created the branch, did you clone it to another directory? If so, it will be harder to find the branch after pulling it into the trunk repo. You may want to read up on bookmarks to label the branch. Also look at how multiple heads work.

注意:另一种选择是使用命名分支,该分支将被永久标记.您无需做任何额外的操作即可在以后切换到它.

Note: The other option is to use named branches which labels the branch permanently. You wouldn't need to do anything extra to switch over to it later.