Reputation: 5726
I have develop
branch in git repository.
git log
shows something similar to:
commit 111
Commit Last
commit 222
Commit Last-1
commit 333
Commit Last-2
What I want to do is:
1. Revert to #333
2. Create a branch Branch-111 which will contain #333 + #111
3. Create a branch Branch-222 which will contain #333 + #222
These new branches should only changes from #333 and one of specified branches.
I tried to create 2 patches. But I can not apply them on #333 - I have multiple patch does not apply
What is the proper way to solve this task?
Upvotes: 0
Views: 31
Reputation: 13589
One way you could handle this is:
git checkout -b Branch-111 <hash of "commit 111">
git rebase -i HEAD~~~
# delete line for "commit 222"
git checkout -b Branch-222 <hash of "commit 222">
Upvotes: 0
Reputation: 30156
git branch branch222 develop~1 # this branch can be kept as is
git checkout -b branch111 develop~2
git cherry-pick develop # apply 111 change
git branch -f develop develop~2 # take back develop 2 revisions
That should do
Upvotes: 2