Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • @kaartic Thank you for editing the answer and referencing the right commit!
    – VonC
    Commented May 15, 2018 at 11:04
  • 6
    Whilst it's generally good practice to set git config --global core.autocrlf true as in the accepted answer, this answers the OP's question more directly: 'Is there an option like "treat ^M as newline when diffing" ?'
    – drkvogel
    Commented Nov 15, 2018 at 5:54
  • 4
    As of Git 2.20 this doesn't hide ^M's
    – Hoshi
    Commented Apr 1, 2020 at 20:05
  • @user1944491 I didn't notice any regression, meaning it sill ignores eol when diffing with this option in Git 2.26.
    – VonC
    Commented Apr 1, 2020 at 20:08
  • 1
    @VonC Using this argument in the git diff command didn't work. Nor did setting my core.whitespace value on git version 2.20.1 (Apple Git-117) but adding Jason Pyeron's core.pager answer fixed it. YMMV obviously.
    – Hoshi
    Commented Apr 2, 2020 at 14:17