Clone wiki

mercurial/extensions/localbranch / Home

original version & docs


  • hg lbranch behaves the same way as branch when it comes to branch listing

hg lbranch

list only current branch

hg lbranches

list available branches

To change lbranches your working directory must be clean. When switching lbranches, the latest revision of the lbranch is checked out. That is to say:

  • new files committed in a localbranch will be purged automatically when switching to a different branch ie hg lbranch newbranch
  • on the other hand, untracked and uncommitted files in a local branch will prevent you from switching to a different localbranch and the following message will be shown: abort: uncommitted changes:

in which case you can do one of the following:

  • commit changes
  • save working copy with mq, the attic ext, or the shelveExtension
  • use the -f flag to force switching (in this case these files will be purged. You have been warned!)
  • use the -i flag to ignore untracked files (in this case, these files WILL NOT be purge.)
    • You can use -f and -i together to purge uncommitted changes in tracked files but ignore untracked files.

how to install

hg clone localbranch

activate the new extension in your ~/.hgrc :

localbranch = ~/path/to/localbranchextension/

future plans

  • converting a localbranch into a normal named branch -> this would provide a workflow akin to git