Reputation: 11
I am struggling to create a patch for a file which does contain some ^M at the end of a line. when I edit the file I don't see the ^M, but the patch created by format-patch does point it out in the patching zone context. So when I try to apply it on a fresh git tree, git am is searching for this ^M at the end of line but doesn't see it; and it results of an error.
any idea or workaround for git format-patch to stop taking this ^M into account ?
Thanks in advance
PS: for the context, I have no write access on this git tree, that's why I need to make patches.
Upvotes: 1
Views: 2184
Reputation: 1833
git format-patch --ignore-space-change --ignore-whitespace -1 mychanges.patch
This helped me. You can get a better understanding if you read this .
Upvotes: 0
Reputation: 32701
Git indicates the CR of Windows-style lineendings with ^M. These should disappear if you convert the File to Unix-style lineendings.
One downside of turning off autocrlf is that the output of git diff highlights CR characters (indicated by ^M) as whitespace errors. To turn off this “error”, you can use the core.whitespace setting:
cf. http://lostechies.com/keithdahlby/2011/04/06/windows-git-tip-hide-carriage-return-in-diff/ or this StackOverflow Question: git-diff to ignore ^M
Upvotes: 1