Confirming Real CRLF, Byte by Byte
git show HEAD:party-playlist.md | cat -A | head -1
^M$ at the end of a line is a real, literal carriage return before the newline — genuine CRLF, not a visual artifact.
The Real Fix
Committed once, this real .gitattributes rule tells git to store every real text file with LF line endings in the repository itself, regardless of what a given checkout's working directory looks like.
Applying It Retroactively
git add --renormalize .
git diff --cached --stat
A real, one-time pass that re-stages every already-committed file according to the current rules — git diff --cached --stat shows exactly which real files actually changed.
Confirming the Real Fix
git show HEAD:party-playlist.md | cat -A | head -1
No more ^M — genuinely LF-only now, confirmed the same way the problem was confirmed.
party-playlist.md was committed with real, genuine CRLF line endings — the exact kind a Windows checkout with certain settings produces. Left alone, every future edit on a different real machine risks a diff that shows every single line as changed, purely from line-ending noise.
* text=auto eol=lf is the real, standard .gitattributes fix: normalize every real text file to LF inside the repository, regardless of what a given checkout's working directory shows. git add --renormalize . applies that rule retroactively to everything already committed — a real, one-time pass, confirmed here at the actual byte level rather than just trusting the setting.
* text=auto eol=lf
A real, standard .gitattributes rule: git detects real text files automatically and normalizes their line endings to LF in the repository. Confirmed directly in this lab: a genuinely CRLF file became LF-only after a renormalize pass.
git add --renormalize
Re-stages every real, already-committed file according to the CURRENT .gitattributes rules — a real, one-time retroactive fix. Confirmed directly in this lab: it produced a genuine, committable change for the one file that actually needed it.
Takeaways
- cat -A (or an equivalent byte-level view) makes a real, literal CRLF visible as ^M — do not trust a visual guess
-
- text=auto eol=lf is the real, standard .gitattributes rule for normalizing text file line endings to LF
- git add --renormalize . applies the current rules retroactively to everything already committed
- Only files that actually need normalizing show up in the renormalize diff — everything else is untouched