mercurial - merge 来自不同存储库的Mercurial分支

标签 mercurial branching-and-merging

我试图弄清楚如何将分支从一个单独的仓库合并到当前仓库。

我有以下内容:

PJT1
-包含默认的分支和foodog

PJT2
-包含分支默认

从PJT2,我执行以下操作:

$ hg fetch -y ../PJT1 -r foodog -m "this is a test"

现在,如果我查看PJT2,我会看到正确的文件和更改。但是,如果我执行hg branches,则会得到以下信息:
[someone@myhome pjt2]$ hg branches
foodog                         1:c1e14fde816b
default                        0:7b1adb938f71 (inactive)
hg branch显示以下内容:
[someone@myhome pjt2]$ hg branch
foodog

如何从PJT1的foodog分支获取内容到PJT2的default分支?

最佳答案

您需要合并,但是请记住,foodog分支上的更改将始终在foodog上-分支永远不会消失,但是它们可以隐藏。该命令序列与您要询问的内容非常接近:

cd PJT2
hg update default # just in case you were somewhere else
hg pull ../PJT1 -r foodog  # that gets you foodog
hg merge foodog  # that merges the changes into default
hg commit # commit the merge
hg update foodog # go to the most recent change in foodog (note: it is not a 'head')
hg commit --close-branch

合并后,除非您执行hg branches(仅显示带有头的分支),否则foodog仍将显示hg branches --active。在commit --close-branch之后,除非您执行foodog,否则您将看不到hg branches --closed

因为Mercurial中的分支永远不会完全消失(一种设计功能),所以它们通常仅保留给诸如release-1.0stable之类的终身使用。对于漏洞和功能之类的短暂工作,请考虑使用书签。这是两者的绝佳对比:http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial

关于mercurial - merge 来自不同存储库的Mercurial分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5186976/

相关文章:

mercurial - 使用 Mercurial 进行空提​​交

TFS:使用主分支的更改更新分支

mercurial - 我可以稍后在 Mercurial 中修复不正确的文件移动吗?

mercurial - 显示一个分支的负责人?

git - 如何在团队成员之间共享大型 git merge

git - merge Git 存储库中的两个远程分支

git - 在 Git 中将一个更改 merge 到多个分支

Eclipse/Subclipse : Switch from branch to trunk with modified sources?

caching - 创建 Mercurial 存储库的本地透明缓存

version-control - 重建/重建 Mercurial 存储库