I have BranchA which is 113 commits ahead of BranchB.
But I only want the last 10 or so commits from BranchA merged into BranchB.
Is there a way to do this?
I have BranchA which is 113 commits ahead of BranchB.
But I only want the last 10 or so commits from BranchA merged into BranchB.
Is there a way to do this?
 
    
     
    
    The git cherry-pick <commit> command allows you to take a single commit (from whatever branch) and, essentially, rebase it in your working branch.
Chapter 5 of the Pro Git book explains it better than I can, complete with diagrams and such. (The chapter on Rebasing is also good reading.)
Lastly, there are some good comments on the cherry-picking vs merging vs rebasing in another SO question.
If BranchA has not been pushed to a remote then you can reorder the commits using rebase and then simply merge. It's preferable to use merge over rebase when possible because it doesn't create duplicate commits.
git checkout BranchA
git rebase -i HEAD~113
... reorder the commits so the 10 you want are first ...
git checkout BranchB
git merge [the 10th commit]
