Why is git apply of a patch with binary files not creating the binary files?

Anjo John picture Anjo John · Apr 22, 2016 · Viewed 13k times · Source

I have a git patch with two binary files (it's libraries, newly added). I tried to apply the patches but the binary files are not created. I tried git apply with the --binary option. Is there any other option to add the binary files from git patch? I only need the binary files.

Answer

espinchi picture espinchi · Feb 25, 2017

The --binary option is used when you create the patch file, not when you apply it.

That means, instead of your current git diff branch1 branch2 > patch-file, you have to do this instead: git diff branch1 branch2 --binary > patch-file. And, then, apply the patch with git apply patch-file in the same way as you're doing.