Sorry if the title is misleading, but I'm not really sure how to describe the situation I've got.
I've commits and branches like this
A --- B --- C --- D (master)
\
E (another)
and I want to remove commits B
and C
(preserving D
) from master
branch but keep them in another
branch which is based on master.
So after the transformation my tree should look like this:
A --- D (master)
\
B --- C --- E (another)
I figured, that I probably should just rebase master
, but then I'm not sure if B
and C
will still be included in another
not to mention removing / omitting D
from it.
How should I proceed to achieve effect discribed above?
Assuming you want to move the changesets, It should not be that hard:
git rebase --onto A C master
This will move branch master
to be on top of A, discard revisions up to C (so only D will me moved, along with the branch pointer). Then:
git rebase --onto C D another
This will rebase E on top of C, discard revisions up to D (in other words, move only E on top of C...move branch pointer as well).
That should do.