Paymahn Moghadasian
Paymahn Moghadasian

Reputation: 10339

HG rebase using bookmark names

In git we can run commands like:

git checkout master
git pull
git checkout mybranch
git rebase master

which will take the commits made on mybranch and rebase them onto the updated master. ie: linearlize the commits of master and mybranch. I know that there's a rebase extension for mercurial but it seems it does rebasing based on revision numbers instead of bookmark names. Is there a way to make it work with bookmark names?

Upvotes: 0

Views: 985

Answers (1)

Reimer Behrends
Reimer Behrends

Reputation: 8730

The hg rebase command accepts not only revision numbers, but also bookmarks, tags, branch names, revsets; basically, anything that can be used to refer to a revision (like practically any command that takes REV arguments). No Mercurial command that I can think of is limited to revision numbers only (see hg help revisions and hg help revsets).

That said, while you can operate Mercurial entirely in a Git-like fashion (and if that's what you are most comfortable with, you should definitely stick with it), note that linearizing history is a Git peculiarity, because Git's history is largely anonymous. Version control systems with named branches (e.g. Mercurial or Fossil) or with hierarchical logs (e.g. Bazaar) do not really need to linearize history.

Rebase can, of course, still be useful for other purposes, or if you prefer to use bookmarks instead of named branches.

Upvotes: 5

Related Questions