Is it possible to reopen a closed branch in Mercurial?

Mercurial

Mercurial Problem Overview


I understand that it is possible to close a named branch in Mercurial, so that it will not appear in the hg branches list:

hg commit --close-branch -m 'close badbranch, this approach never worked'

Is it possible to later re-open the branch if need be?

Mercurial Solutions


Solution 1 - Mercurial

You can just hg update to the closed branch then do another hg commit and it will automatically reopen.

The closed flag is just used to filter out closed branches from hg branches and hg heads unless you use the --closed option - it doesn't prevent you from using the branches.

Solution 2 - Mercurial

> You can reopen a branch by using the "-f" flag when 'creating' the branch.

No, this command will create a new branch with the same name.

Just forget that it's closed. Switch to the branch, make the changes and commit. It will be automatically reopened. When you're done you can close it again.

Solution 3 - Mercurial

try with following:

hg pull && hg update branch_name

Now make a small change to one of the file and then commit it

 hg commit -m "minor change"

then push it

hg push -b . 

Now you should be able to work normally.

Solution 4 - Mercurial

Try this.

Switch to the closed branch before executing. ( hg up closed_branch )

hg st

touch a

add a

hg commit -m 'reopening the closed branch'

This will reopen the closed branch.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLóránt PintérView Question on Stackoverflow
Solution 1 - MercurialTim DelaneyView Answer on Stackoverflow
Solution 2 - MercurialRafael PiccoloView Answer on Stackoverflow
Solution 3 - MercurialDipendraView Answer on Stackoverflow
Solution 4 - MercurialGeetanjaliView Answer on Stackoverflow