.gitattributes: Line Endings and Diff Drivers
A real CRLF file, already committed. Normalized to LF for good, confirmed byte by byte.
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.\n\n* 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.
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
* text=auto eol=lf
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.
* 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.
🔍 Confirm the Real Problem, Byte by Byte
Not a visual guess — the actual, literal carriage return.
cd ~/team-recipes && git show HEAD:party-playlist.md | cat -Astudent@lab:~$ cd ~/team-recipes && git show HEAD:party-playlist.md | cat -A Party Playlist^M$ ^M$ Upbeat songs for cooking with friends.^M$
📐 Commit the Real Fix
One real, standard rule, committed once.
cd ~/team-recipes && printf '* text=auto eol=lf\n' > .gitattributescd ~/team-recipes && git add .gitattributescd ~/team-recipes && git commit -m "RECIPE-305: Normalize line endings to LF"student@lab:~$ cd ~/team-recipes && printf '* text=auto eol=lf\n' > .gitattributes student@lab:~$ cd ~/team-recipes && git add .gitattributes student@lab:~$ cd ~/team-recipes && git commit -m "RECIPE-305: Normalize line endings to LF" [master 545d2a8] RECIPE-305: Normalize line endings to LF 1 file changed, 1 insertion(+), 3 deletions(-)
🔄 Apply It Retroactively
A real --renormalize pass, and a real commit for what it found.
cd ~/team-recipes && git add --renormalize .cd ~/team-recipes && git diff --cached --statcd ~/team-recipes && git commit -m "RECIPE-306: Renormalize line endings"student@lab:~$ cd ~/team-recipes && git add --renormalize . student@lab:~$ cd ~/team-recipes && git diff --cached --stat party-playlist.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) student@lab:~$ cd ~/team-recipes && git commit -m "RECIPE-306: Renormalize line endings" [master d39b064] RECIPE-306: Renormalize line endings 1 file changed, 3 insertions(+), 3 deletions(-)
✅ Confirm the Real Fix, Byte by Byte
The same real check as objective 1 — this time, no carriage return.
cd ~/team-recipes && git show HEAD:party-playlist.md | cat -Astudent@lab:~$ cd ~/team-recipes && git show HEAD:party-playlist.md | cat -A Party Playlist$ $ Upbeat songs for cooking with friends.$
Lab 3.6.3 complete. A real CRLF file, normalized to LF for good, confirmed at the byte level:\n\n\n Real CRLF confirmed : ✅ cat -A showed ^M\n .gitattributes committed: ✅ text=auto eol=lf\n Renormalized : ✅ real commit\n Fix confirmed : ✅ no more ^M\n
Enable JavaScript to run the live terminal and track your progress.