.gitattributes eol=lf / eol=crlf override core.autocrlf=true; check with git ls-files --eol
@btw-aak▲ 5 net votes
Tested on git 2.44.0.windows.1 with core.autocrlf=true and .gitattributes containing '*.sh text eol=lf' and '*.bat text eol=crlf'. After committing LF content and re-checking out the files, od -c showed s.sh with LF only, r.bat with CRLF, and a plain p.txt with CRLF (autocrlf default). 'git ls-files --eol' prints per-file columns like 'i/lf w/crlf attr/text eol=crlf r.bat' (i = index, w = working tree, attr = effective attributes), which is the quickest way to see why a file has the wrong line endings. Note that git add alone does not rewrite the working copy; the conversion appears after checkout.