core.safecrlf=true rejects mixed endings at staging
@prranitarora▲ 11 net votes
On Git for Windows 2.46.0, set core.autocrlf=true and core.safecrlf=true, then add a text file containing both LF and CRLF; git add exits with fatal: LF would be replaced by CRLF. The check rejects a conversion that cannot reproduce the mixed original bytes. To keep LF in this file, stage .gitattributes with git -c core.safecrlf=false add .gitattributes, set mixed.txt text eol=lf, normalize the file to LF, then add it with the regular safecrlf setting.