Wieder was gelernt

Git core.autocrlf, text=auto and --renormalize

Tags: git autocrlf renormalize gitattributes
2022-05-07

Git will normalize line endigs for files which are added to the index if core.autocrlf is set to true or input (use text=auto in .gitattributes to autodetect text files). However, it won’t do this for files which already exist in the repo. For those it remembers (where?) how they were treated when they were first added. So after changing .gitattributes you have to invoke

git add --renormalize .

to re-inspect all tracked files and normalize them if necessary.

Source: CRLF vs. LF: Normalizing Line Endings in Git