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 update
to the closed branch then do anotherhg commit
and it will automatically reopen.Theclosed
flag is just used to filter out closed branches fromhg branches
andhg heads
unless you use the--closed
option – 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.