我试图弄清楚如何将分支从单独的存储库合并到当前存储库中。
我有以下内容:
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)
and hg branch
揭示了以下内容:
[someone@myhome pjt2]$ hg branch
foodog
如何从 PJT1 获取内容foodog
分支到 PJT2default
branch?
您需要合并,但请记住分支 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.0
or stable
。对于诸如错误和功能之类的短期工作,请考虑使用书签。这是两者的一个很好的比较:http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)