what's the difference between hg tag and hg bookmark?

Jason S picture Jason S · Mar 22, 2011 · Viewed 12.4k times · Source

What's the difference between a tag and a bookmark in Mercurial? I can't seem to find any discussion of how the two differ.

Answer

gizmo picture gizmo · Mar 22, 2011

Lets consider your repository as a "choose your own adventure books", with different points of view.

  • A tag is like a stamp that the editor put on your manuscript to say "ok, we keep a trace of your current work, in case shit happens."
  • A named branch would be a chapter. You have to choose at one point which chapter you'll have to write, and they are there to stay. Some will merge back, some will end (sorry, you died.)
  • A bookmark is, well, a bookmark. It follows you while you're reading (committing) the book. It helps you to keep tracks of "what you were reading at that time", so you can remove them, move them to a different "chapter". When you share the book (push), you usually don't share your bookmarks, unless you explicitly want to. So you usually use them on anonymous branches because their life cycle is shorter than named branches.