Let's say I create two banches at the same time:
hg branch branch-A
hg branch branch-B
How do I send my next commit to branch-A instead of branch-B?
If you want to see what tracking branches you have set up, you can use the -vv option to git branch . This will list out your local branches with more information including what each branch is tracking and if your local branch is ahead, behind or both.
A branch represents an independent line of development. Branches serve as an abstraction for the edit/stage/commit process. You can think of them as a way to request a brand new working directory, staging area, and project history.
hg branch X
does nothing except tell Mercurial "the next commit I make should be on branch X." It doesn't actually "create" the branch. A branch doesn't exist until there's at least one commit on it:
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
$
So the answer to your question is: "use hg branch branch-A
to mark the next commit as being on branch-A."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With