Wednesday, 3 November 2010

hg rebase or how to move trunk/default changesets to a branch

One wishes to move changesets on trunk (starting with revision A onwards) to a new branch B.

  1. Enable the Rebase extension for you / the repository per the RebaseExtension docs
  2. If outstanding changes, commit or shelve them!
    (otherwise next step will generate merge request)
  3. hg update <A-1>
    (the one before you wish to move to branch B)
  4. hg branch B
  5. hg status
    confirm output has no actual changes (branch change won't be shown)
  6. hg commit -m 'create B'
  7. hg branches
    get actual revision for B, we'll call it C
  8. hg rebase -s A -d C
That's it.  If insufficiently clear, I can post some screenshots, etc.  Do ask but expect delayed response unless you tweet me!