Try a:
git apply --ignore-space-change --ignore-whitespace patch.diff
As mentioned in “git: patch does not apply”, this can be caused by:
- the line endings differing between the local file system and the remote repo.
Usercore.eolin.gitattributesfile is a good approach (see “git force file encoding on commit”) - the execution bit (‘
x‘).
That can lead you to setgit config core.filemode false, followed by agit reset --hard HEAD(make sure you don’t have uncommitted changes, or they would be lost).