How to reopen a closed branch in Hg/Mercurial – via: Stack Overflow
Posted by jpluimers on 2015/08/12
Thanks to the answers and comments on stackoverflow, here are my steps to resurrect a closed hg branch:
- List all branches (including closed ones)
hg branches --closed
- Switch to a closed branch
hg update my_closed_branch_name
- Change anything
- For instance by adding a tag, as that is considered a versioned and mergeable change)
hg tag reopened_my_closed_branch
- Or making a change to a file, then ommit your changes
hg commit -m "I changed a message"
- For instance by adding a tag, as that is considered a versioned and mergeable change)
This works because of what Lazy Badger explained in another answer which summarised is:
A commit on top of a closed head effectively opens the head.
Note: if you while experimenting with this, you want to undo your last change before committing, perform this command to revert back one revision:
hg update -C -r .
The answers and comments (thanks Lóránt Pintér for asking the question):
You can just
hg updateto the closed branch then do anotherhg commitand it will automatically reopen.Theclosedflag is just used to filter out closed branches fromhg branchesandhg headsunless you use the--closedoption – it doesn’t prevent you from using the branches.The commit won’t do anything unless there is something to actually commit, so you may need to make a gratuitous change to make it happen.
A tag is sufficient to make it commitable.
–jeroen
via: Is it possible to reopen a closed branch in Mercurial? – Stack Overflow.






Leave a comment