I’m on branch foo, with parent A:
---A---foo
I want to partition the changes from A to foo into two branches, both
based on A. I believe I can do half the job like this:
git checkout -b halfFoo
git reset HEAD~
# Only choose half the stuff.
git add -i
git commit
That gives me:
---A---foo
\
\-halfFoo
I know how to get it to this (git checkout -b otherHalfFoo; git commit -a):
---A---foo
\
\-halfFoo
\
\-otherHalfFoo
But what I’d like is to get this:
---A---foo
|\
| \-halfFoo
\
\-otherHalfFoo'
How can I do this without having to go through the ‘git add -i’ (and
selecting the negative of what was chosen for halfFoo) again?
First, rewind to your previous commit, leaving in the changes since. Then branch off and apply some of the changes. Branch off from the original branch again, and apply the rest of the changes.