Git apply skips patches

Iulian Onofrei picture Iulian Onofrei · Feb 22, 2017 · Viewed 11.7k times · Source

I'm trying to apply a patch that includes binary files with git apply but only the files are added. I tried running git apply failing.patch -v and it prints something like:

Skipped patch 'file.txt'.
Checking patch file.bin...
Applied patch file.bin cleanly.

How can I find out what's the reason of the skip? As the current message is not very enlightening.

Answer

Iulian Onofrei picture Iulian Onofrei · Feb 22, 2017

I found out the problem by running patch -p1 < failing.patch which printed:

can't find file to patch at input line 5

and reminded me that I was not in the root directory.

I can't understand why no one had asked this before and why is the verbose message not verbose.

Also, not even the official documentation mentions skipping and possible causes.