Question

When using Mercurial, assume you are using a 'default' branch. You work by creating new branches from this and merging them back into 'default' (when your work on that new branch is finished).

After merging a new branch (call it 'myBranch') back into 'default', you actually decide you need to work on 'myBranch'. 'myBranch' has not since been closed. What is the best to go about working on 'myBranch'?

Was it helpful?

Solution

  1. Merging of branch (in Mercurial) doesn't mean it will become closed|disappeared. Used ranch is permanent part of Mercurial changeset forever
  2. Merge will not close branch, just remove HEAD of merged branch
  3. Because Mercurial's history is DAG, you can always return (hg up CS-ID) to any entry (changeset) in it and start working from this point, adding new child changeset on commit
  4. For named branches, branchname is CS-ID of HEAD of latest (topologically) changeset of this branch

Long-term branch merging

For LTB "Cleanup" I used hg up Cleanup after each merge it to Default branch

OTHER TIPS

Nothing extra to do. If you want to continue from the last commit in myBranch do:

hg checkout myBranch   # checks out last commit in myBranch
...hack...
hg commit              # creates a new commit on myBranch

If, instead, you want to re-open myBranch with whatever is currently on deafult (rare) you do:

hg checkout default
hg branch --force myBranch  # says "next commit should be on branch myBranch and I don't care if there already was one"
...hack...
hg commit

You probably want the first.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top