Pau*_*aul 30 mercurial branching-and-merging
我试图弄清楚如何将分支从单独的仓库合并到当前.
我有以下内容:
PJT1 - 包含分支默认和foodog
PJT2 - 包含分支默认值
来自PJT2,我做了以下几点:
$ hg fetch -y ../PJT1 -r foodog -m "this is a test"
Run Code Online (Sandbox Code Playgroud)
现在,如果我查看PJT2,我会看到正确的文件和更改.但是,如果我这样做hg branches,我会得到以下内容:
[someone@myhome pjt2]$ hg branches
foodog 1:c1e14fde816b
default 0:7b1adb938f71 (inactive)
Run Code Online (Sandbox Code Playgroud)
并hg branch揭示以下内容:
[someone@myhome pjt2]$ hg branch
foodog
Run Code Online (Sandbox Code Playgroud)
如何从PJT1的foodog分支机构获取PJT2 分支的内容default?
Ry4*_*ase 55
你需要合并,但要记住分支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
Run Code Online (Sandbox Code Playgroud)
合并后hg branches仍然会显示合并,foodog除非你hg branches --active只显示那些有头的分支.之后,commit --close-branch你将看不到foodog,除非你做hg branches --closed.
这是因为Mercurial中的分支机构永远不会完全消失(一种设计特征),它们通常只保留用于release-1.0或等的终身事物stable.对于像bug和功能这样的短期工作,请考虑使用书签.以下是两者的比较:http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial
| 归档时间: |
|
| 查看次数: |
37416 次 |
| 最近记录: |