When I try to apply a patch from a file, I see
error: cannot apply binary patch to 'my/resource.png' without full index line error: my/resource.png: patch does not apply
I added my/resource.png
in the commit from which I made the patch. How can I enabled full-index support?
Checkout the branch from which you want to create the patch. Run this command:
git diff-index 79fd4d7 --binary > ~/Desktop/my-patch
Where 79fd4d7
is a placeholder for the commit that came right before the range of commits you want to diff. (e.g. I want a patch that contains the first three commits below:
aaa02b0 third commit mine
aabbbcc second commit mine
bb82aed first commit mine
79fd4d7 old commit
Then checkout your new branch and run git apply ~/Desktop/my-patch
I want to post another way if you have only deleted some files and get the same message. Because I didn't had access to the source code anymore (through reset to another commit), I needed another solution (instead of creating a new patch file).
Therefore I deleted the following parts from my patch file:
diff --git a/MyProject/Libraries/some.dll b/MyProject/Libraries/some.dll
deleted file mode 100644
index a0908d7..0000000
Binary files a/MyProject/Libraries/some.dll and /dev/null differ
diff --git a/MyProject/Libraries/some.dll.mdb b/MyProject/Libraries/some.dll.mdb
deleted file mode 100644
index d3c3912..0000000
Binary files a/MyProject/Libraries/some.dll.mdb and /dev/null differ
Afterwards I could apply my patch file with success! Don't know why he wants to make a binary compare on a deleted file ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With