Reputation: 21682
I have three branches (let's call them master, testing, and feature). All three are shared, so I cannot rebase any of them without causing problems for others. Currently, all three branches have diverged (none is a fast-forward), so eventually some merging will need to done, since rebasing is not an option.
For the moment, though, I would like to pull in the Makefile from testing into feature, since feature was split off from master, and the Makefile was added in testing. I do not want to merge in any other changes between the two branches, however.
My understanding is that if I just git-add Makefile to feature, this will cause merge conflicts when I merge feature back into testing (and then master), especially if I make any further additions to the Makefile in my feature branch.
I could do git-cherry-pick; however, there were multiple commits to the Makefile in testing, and I assume there's a better way than trying to cherry-pick all of those commits into feature.
Upvotes: 7
Views: 4530
Reputation: 2388
You can just do a
git checkout branch_name <path(s)>
This can load a specific file but you can also use wildcards and directories
Note that:
Upvotes: 12