Mercurial Rebase

I read Martin Fowler’s entry on using mqueues in Mercurial to squash a series of commits into a single commit, and while the post is informative, there’s an easier way: the Mercurial rebase command. The rebase extension has been included in Mercurial since 1.3, although it’s been available since sometime in the 1.2 release, and can perform a number of useful alterations of a repository. For Martin’s use case, his 5-step mqueue sequence is accomplished with two much more simple commands: hg tag “Pre-rebase” hg rebase -s –collapse The tag is necessary because the rebase command will not operate on descendants or ancestor, and will not automatically create a new tip to hold the rebase.

Read More