Search code examples
mercurialbranch

Mercurial: make one branch identical to another


I'm working with another developer who's relatively new. In order to allow me to do code review on her work, I had her create a branch which I can review and periodically merge if I am happy with the changes.

That branch has gotten hosed, so I just want to "reset" it, so that it's identical to the mainline, so she can start again from clean code.

I could create a new branch, but I'd like to keep the same name and avoid creating unnecessary copies.

So how do I make branch B exactly the same as branch A?


Solution

  • (Simple curiosity: how has that branch been "hosed"?)

    You can close the current code review branch, then start another with the same name with --force.

    hg com --close-branch -m "closing"
    hg branch "same_name" --force