This was tricky because cherry-pick doesn't work in this case, unless commits are really granular.
An easier way:
- git reset HEAD~10 (where you have 10 commits of work you want to redo).
- git add -Ap (this sais "add interactively each patch, including those in new files)
- now, interactively, hit "y" to select the first "wave" of patches you want to keep. for things in the next feature, just hit "n".
- git commit -m "first feature".
- Redo the second step over and over, until your head is totally clean.
- Now, you have your commits separated into features.
- Branch off of your original branch, and delete all commits that you don't want. Call this "feature1"
- Branch off of your original branch, and delete all commits that you don't want. Call this "feature2"
- Branch off of your original branch, and delete all commits that you don't want. Call this "feature3"
Thats it! Now you have restructured your code into feature branches which span the exact contents you care about.
The TL;DR version for people already familiar with git? User "reset HEAD~..." to unwind your commits, re-add them using git -Ap, and make sure to get author names right!, and finally, make feature branches from the branch you did this on accordingly.
No comments:
Post a Comment