定义我的下一个提交添加到哪个分支

uzo*_*uzo 11 mercurial branch

比方说,我创建两个banches 在同一时间:

hg branch branch-A
hg branch branch-B
Run Code Online (Sandbox Code Playgroud)

如何将我的下一次提交发送到branch-A而不是branch-B?

Ste*_*osh 21

hg branch X并没有什么不同之处告诉水银"下一个承诺我做应该是分支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
$ 
Run Code Online (Sandbox Code Playgroud)

因此,您的问题的答案是:"用于hg branch branch-A将下一个提交标记为在分支A上."

  • 很好的信息,但可能值得添加OP正在尝试做的方式:hg branch branchA; 承诺branchA; hg update default; hg branch branchB,提交到branchB.关键是"hg update default",因此branchB基于与branchA相同的提交. (3认同)