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 https://pk11@bitbucket.org/pk11/mercurial-extensions-localbranch/ localbranch

activate the new extension in your ~/.hgrc :

localbranch = ~/path/to/localbranchextension/localbranch.py

future plans

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


Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.