Git How to: pull diff between branches

Wojtek Turowicz picture Wojtek Turowicz · Dec 12, 2011 · Viewed 8.7k times · Source

I would like to download the files that are the difference between two branches into a local folder. Is it possible with Git?

Given the files are only added to the source branch, they are not changed.

Answer

Sergio Tulentsev picture Sergio Tulentsev · Dec 12, 2011

You can get all changes between branches with something around these lines:

git diff origin/master origin/develop > my_diff.diff

If you only add [text] files, then it would be trivial to parse the diff file and break it into individual files. (I'd say, it's a ruby script under 50 lines of code)