假设我创建两个banches 与此同时:
hg branch branch-A
hg branch branch-B
我如何发送我的下一个提交 分支-A 代替 分支-B?
假设我创建两个banches 与此同时:
hg branch branch-A
hg branch branch-B
我如何发送我的下一个提交 分支-A 代替 分支-B?
hg branch X
不 没有 除了告诉Mercurial“我做的下一个提交应该在分支X上。”它实际上并没有“创建”分支。在至少有一个提交之前,分支不存在:
sjl at ecgtheow in ~/Desktop/test on default at tip
$ hg branch a
marked working directory as branch a
sjl at ecgtheow in ~/Desktop/test on a at tip
$ hg branch b
marked working directory as branch b
sjl at ecgtheow in ~/Desktop/test on b at tip
$ hg branches
default 0:aae011bc1b00
sjl at ecgtheow in ~/Desktop/test on b at tip
$ echo foo >> x
sjl at ecgtheow in ~/Desktop/test on b at tip!
$ hg com -m1
sjl at ecgtheow in ~/Desktop/test on b at tip
$ hg branches
b 1:b66106035d8d
default 0:aae011bc1b00 (inactive)
sjl at ecgtheow in ~/Desktop/test on b at tip
$
所以你的问题的答案是:“使用 hg branch branch-A
将下一次提交标记为在分支A上。“
hg branch X
不 没有 除了告诉Mercurial“我做的下一个提交应该在分支X上。”它实际上并没有“创建”分支。在至少有一个提交之前,分支不存在:
sjl at ecgtheow in ~/Desktop/test on default at tip
$ hg branch a
marked working directory as branch a
sjl at ecgtheow in ~/Desktop/test on a at tip
$ hg branch b
marked working directory as branch b
sjl at ecgtheow in ~/Desktop/test on b at tip
$ hg branches
default 0:aae011bc1b00
sjl at ecgtheow in ~/Desktop/test on b at tip
$ echo foo >> x
sjl at ecgtheow in ~/Desktop/test on b at tip!
$ hg com -m1
sjl at ecgtheow in ~/Desktop/test on b at tip
$ hg branches
b 1:b66106035d8d
default 0:aae011bc1b00 (inactive)
sjl at ecgtheow in ~/Desktop/test on b at tip
$
所以你的问题的答案是:“使用 hg branch branch-A
将下一次提交标记为在分支A上。“
正如Carl Meyer所说,我会选择:
hg branch branch-A
commit branch-A
hg update default
hg branch branch-B
commit branch-B
具有讽刺意味的是,我认为Steve Losh在他的指南中提供了一个更好的答案(尽管“一个分支在它至少有一个提交之前不存在”是一个非常好的提示,我将在指南中添加)。
如果你看了 关于命名分支的部分,他简要解释了它们的工作原理以及如何在它们之间切换。
使用 'hg update -C branch-name
”。