Why is git apply of a patch with binary files not creating the binary files?
Solution 1:
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.
Solution 2:
I tried the git apply with --binary option.
That wouldn't affect anything: the git apply
man page mentions:
Historically we did not allow binary patch applied without an explicit permission from the user, and this flag was the way to do so. Currently we always allow binary patch application, so this is a no-op.
So check your git status
and permissions on your repo, as well as your git version.
As a test, try apply that patch on a new repo.