I'm attempting to apply a patch to a file with Windows line endings on a Linux system and I'm getting conflicts due to the carriage returns in the file.
The -l
option (ignore whitespace) isn't ignoring the EOL characters. Is there anyway to get patch to ignore windows style line endings?
Try using the --binary option, from the manpage (emphasis mine)
I don't fully understand the above, but it worked for me on a Linux machine to apply a Unix patch onto a DOS file.
I had this problem with a diff that was manually copied and pasted from
git diff
console output, into a patch file with LFs. To get that patch file to work again - to be able to be applied on the actual files that were using CRs and LFs - several things had to be done manually:joe
syntax highlighting was very helpful there, because it colored hunks properly as soon as I fixed them.Here's a link http://www.chemie.fu-berlin.de/chemnet/use/info/diff/diff_2.html
Run diff like:
diff -w file1.txt file2.txt
I work around this using the following commands to convert all files of interest to unix line endings.