Monday, January 12, 2015

How to merge in specific files from one git branch to another

I found this write up very helpful:

http://jasonrudolph.com/blog/2009/02/25/git-tip-how-to-merge-specific-files-from-another-branch/

git checkout <branch> <file>

So, say you have a feature branch foo and your master branch and you want to get one file, src/bar.c into master

git checkout master
git checkout foo src/bar.c
git commit -m "merging bar.c from foo branch" src/bar.c

That's it. 

No comments: