On Sat, 26 Feb 2011 10:40:03 -0800 Daniel Stutzbach firstname.lastname@example.org wrote:
On Sat, Feb 26, 2011 at 9:55 AM, Antoine Pitrou email@example.com wrote:
There is no such thing as an "unnamed branch". What would "hg branches" show? An empty space?
I understand now why I was confused. I had previously read the sentence "Both Git and Mercurial support unnamed local branches." at http://mercurial.selenic.com/wiki/BranchingExplained
But as I dig deeper, I see that there is only one unnamed branch, and it actually does have an implicit name: "default".
Ok, so beware, the term "branch" can conflate two concepts: - a path in the topology (or line of development) - a "named branch" in hg terminology
So, actually, hg promotes a slightly different terminology: - a "head" is a changeset without a child in the topology - a "branch" usually means a "named branch": a set of changesets bearing the same label (e.g. "default"); that label is freely chosen by the committer at any point, and enforces no topological characteristic (even though in practice it will have, since it's the whole point from the user's perspective, and also because hg's default behaviour and concept of a "current branch" encourages it)
A (named) branch can have zero, one, or several heads: - zero head: if all branch-local heads have a child in another named branch (for example, "trunk" is linearly followed by "2.7") - several heads: if several lines of development were started in this branch without bothering to give them separate names
When you have several heads on a branch, you can merge them together if you want to reconcile the lines of development they represent.
When you have several branches with at least one head each, you can also merge them together: you must be careful to choose which named branch the merge changeset will be part of (for example, if you want to merge "3.1" into "3.2", you will certainly want the merge changeset to be part of "3.2", otherwise "3.1" will get a lot of unwanted features ;-)).
Note: a branch with zero head is marked "inactive" in "hg branches". This basically means that it has already been merged in another branch. (of course, you can still develop in that branch, which will certainly create a new head as soon as you commit your first new changeset)