The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 2,224 other followers

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:

  1. List all branches (including closed ones)
    • hg branches --closed
  2. Switch to a closed branch
    • hg update my_closed_branch_name
  3. 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"

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):

Tim Delaney:

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.

Francis Upton:

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.


via: Is it possible to reopen a closed branch in Mercurial? – Stack Overflow.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: