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.

5
  • 4
    Yep, this made the git diff tool (also used in git show) stop bugging me about the ^Ms on the changed lines! :)
    – Rijk
    Commented Mar 13, 2012 at 15:32
  • 2
    for whatever reason this did not work for me. Tried it both with = and no = sign. git diff still shows ^M characters.
    – Dennis
    Commented Feb 12, 2014 at 20:22
  • 9
    Two ways to do this: one, add the line above verbatim to your .gitconfig either in .git/config, or in ~/.gitconfig; two, git config --global core.whitespace cr-at-eol (where --global is optional if you just want it on the repo you're on) Commented Dec 23, 2014 at 21:27
  • This worked for me on Windows 7, although I just put it under [core] so I can replace the core. prefix with a TAB character.
    – Rufflewind
    Commented Feb 27, 2015 at 3:06
  • 1
    This question was above how to hide ^M in git diff, not about how to not put in ^M in the first place. That means the accepted answer of changing core.autocrlf is not the best because it silently alters the files without user's confirmation.
    – deddebme
    Commented May 3, 2017 at 18:55