views:

227

answers:

1

I read some information about named branches and working with bookmarks. Unfortunately I still don't see a difference between them. Is there any?

Is there any difference between:

hg branch blah
hg up blah

and

hg bookmark blah
hg up blah

?

Why would I use a bookmark and how is it different from a named branch?

+8  A: 

Bookmarks are tags that move forward automatically to subsequent changes, leaving no mark on the changesets that previously had that bookmark pointing toward them. Named branches, on the other hand, are indelible marks that are part of a changeset. Multiple heads can be on the same branch, but one one head at a time can be pointed to by the same bookmark. Named branches are pushed/pulled from repo to repo, and bookmarks don't travel.

There's a great branching comparison here: http://stevelosh.com/blog/entry/2009/8/30/a-guide-to-branching-in-mercurial/

Ry4an
1. Article was updated: "As of Mercurial 1.6 bookmarks can be pushed and pulled between repositories." 2. This explains the differences, but not why you would want to use one over the other
Casebash
The differences should help you pick which model works best for you, and each has clear tradeoffs. Do you want your branch names to stay around forever? Use named branches. Etc.
Ry4an