Restarting a branch

Angel Ezquerra angel.ezquerra at gmail.com
Mon Dec 2 15:51:44 UTC 2013


Hi,

apologies if this has been answered before. I seem to remember a
discussion about this a while ago but I cannot find a quick Google
search did not turn out any useful results.

One of my colleagues asked me today what is the recommended way to
"restart a branch" that has been "abandoned".

For example, imagine that we had the following simple DAG:

@ dev: last commit on the "dev" branch
|
... a certain number of commits in the "dev" branch
|
o dev: commit 2 on the "dev" branch
|
o dev: first commit on the "dev" branch (default was abandoned here)
|
o default: last commit on the default branch
|
...


That is, at some point they stopped committing into default and
instead they committed into dev. This went on for a while but now they
would like to "convert" the dev branch into default.

I see two possible options:

1. Call "hg branch default" before making the next commit on top of
the head of "dev". They could even close "dev" first. This has the con
that now default has two heads, but it results on a pretty clean
history that shows exactly what happened.

2. Merge devel into default. Before committing the merge, do "hg
revert -r devel". This has two problems:
    - You can only do this if the head of default is not an ancestor
of the head of "dev". One solution would be to update to default,
close it, and then merge dev into the "close default" commit.
    - Even if you can do this the resulting history is less clean
(specially if the default branch was "abandoned" a long time ago or if
you need to close default first).

So, are there any other options? Is one of these optiosn what they should do?

Thanks,

Angel



More information about the Mercurial mailing list