Skip to main content

Timeline for Make 'git diff' ignore ^M

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Jul 1, 2022 at 14:50 comment added Kai Carver I know we aren't supposed to say thank you, but THANK YOU. This restores some sanity to my git diff. May I never see another ^M again!
Apr 1, 2020 at 20:08 comment added Hoshi git diff -b did not work, but the config modification did.
Feb 6, 2020 at 22:06 comment added Hoonerbean Yes! Of all the answers to this question, modifying the git "config" file's [core] section by adding pager = tr -d '\\r' | less -REX was the only answer that worked for me. Thank you!
Sep 24, 2018 at 9:09 comment added Martin Burch git diff -b is what I was looking for, but I do appreciate the thorough explanation.
Mar 14, 2018 at 1:55 comment added Mike Thanks for this. This is the only answer if you must work with differing line endings in your repo(s) -- e.g. you use checkout as-is, commit as-is, purposefully.
Feb 1, 2018 at 17:39 comment added labreuer I had this problem in a repo where some of the files had \r\n line endings and some had \n line endings (I don't know if that's relevant); diffs of the former showed the ^M in the modified lines (that is, the + lines). core.autocrlf was set to true. Running git config core.pager "tr -d '\r' | less -REX" got rid of the pesky ^Ms. Thanks!
Sep 17, 2017 at 14:19 history answered Jason Pyeron CC BY-SA 3.0