The history of my repository looks like:
A -- B -- C (branch "foo")
\
-- D (branch "bar")
The two branches are both "shipping" branches, and are essentially different frontends to a common backend.
All the code used to be in one branch, with the foo
or bar
features turned on or off by a compiler switch, but I branched to make it easier to work with each individually.
The problem is that the common "backend" files, by themselves, probably should be a separate branch - and I often want to just work on those common files. Because of the way I created these branches, the history is a bit screwed up: in branch bar
's past, it used to have features from foo
.
Currently, I simply make changes on one branch and then use hg transplant
to copy the same changes to the other branch.
Instead, I'd like to be able to make changes this way:
__ C __ D' (branch "foo")
/ /
A -- B -- D (branch "backend")
\ \
-- E -- D'' (branch "bar")
That is, work on the branch backend
, and then in each of the shipping branches (foo
and bar
), I use hg merge backend
.
What's the best way to go from my current situation to the one I'm describing? The only way I can think of is:
Remove all
foo
andbar
features, and name that branchbackend
.Delete the old
foo
andbar
branches.Manually add
foo
features tobackend
and name that branchfoo
, and likewise forbar
.
Is there a better way?
Also, is this the right thing to do?