Bookmarks - Mercurial
Bookmarks
Working with Mercurial's bookmark feature.
Contents
1.
2.
3.
4.
5.
6.
Overview
Working with bookmarks
Transferring bookmarks
Example usage
Working with remote repositories
See also
1. Overview
Bookmarks are references to commits that can be automatically updated when new commits are made. If you run hg bookmark feature, the feature bookmark refers to the current changeset. As you work and commit changes the bookmark will move forward with every commit you do. The bookmark will always point to the latest revision in your line of work.
Bookmarks can be used as an alternative to NamedBranches for tracking multiple lines of development. Systems like Mercurial, CVS, and Subversion store their branch information as a permanent part of each commit. This is useful for future auditing of longlived branches, as it's always possible to identify which branch a commit was introduced on. Git, by contrast, has "branches" that are not stored in history, which is useful for working with numerous short-lived feature branches, but makes future auditing impossible. Mercurial's bookmark feature is analogous to Git's branching scheme, but can also be used in conjunction with Mercurial's traditional named branches.
2. Working with bookmarks
Bookmarks can be active or inactive. Only a single bookmark can be active at any given time, and only a bookmark that points to the current revision can be active. Mercurial only tracks and updates the currently active bookmark (if there is any). This is similar to Git's approach to branching and can be used to replicate the traditional Git branching workflow. When a bookmark is created it is active by default, but an inactive bookmark can be created by passing the --inactive (or -i) flag. The currently active bookmark can be inactivated by executing hg bookmark --inactive. A given bookmark can be activated by updating to that bookmark (e.g. hg update --rev feature updates to the revision pointed to by