Search code examples
mercurialbranchdvcs

Mercurial: Can I rename a branch?


We now have a "stiging" branch, where "staging" seems to be a far better semantic fit. What's a good strategy for handling this?


Solution

  • Update to the stiging branch and create a new branch off of it. Then close the old branch.

    In summary:

    hg update stiging
    hg branch staging
    hg commit -m"Changing stiging branch to staging."
    hg update stiging
    hg commit --close-branch -m"This was a typo; use staging instead."
    hg push --new-branch