Mercurial Branching Vs Bookmarking#

If you wish to use the branching workflow in Mercurial, as mentioned in the Workflow Support section, then there is a subtle but important difference to note between what branching means in Git and Mercurial.

  • Mercurial stores branch information as a permanent part of each commit. Each branch needs to be named and is assigned persistent symbolic links inside the repository.

  • In Git, by contrast, a branch is simply a lightweight movable pointer to a commit.

This is where bookmarks replicate the Git branch functionality in Mercurial. A bookmark is a references to a commit that can be automatically updated when new commits are made. For more information, see the Mercurial Bookmark documentation.

To use Mercurial bookmarks like Git branches, see the following example.

# Make a bookmark particular revision
$ hg bookmark -r 3400 my-bookmark

# push the bookmark to the server
$ hg push -B my-bookmark

# Delete remote bookmark, by deleting locally, then push deletion
$ hg bookmark -d my-bookmark
$ hg push -B my-bookmark

To open a pull request from a bookmark using RhodeCode Enterprise, use the usual pull request steps.