Re: Why doesn't git core.eol=lf work?
- From
- Jason Cho <jason11choca@proton.me>
- Date
- Jul 12, 2025, 10:56 UTC
- Message-ID
- <hmmjz8ewCl8dl_K4NrydJHLRzLtjs8vGanKXkbJjDPgaaZvj9HzyzEkrY9WlciWgx0iNlcWPhwGpl1E2gxQkRpG_10KgmHDareAH7LQj33A=@proton.me>
- In-Reply-To
- <20250712103030.GA30568@tb-raspi4>
Show 6 quoted lines
> But now to the real stuff: > It may be that your file had been commited with LF or mixed CRLF into the repo. > In this case will Git not change CRLF into LF at checkout. > What does > git ls-files --eol license_header.txt > give you ?
$ git ls-files --eol license_header.txt i/crlf w/crlf attr/ license_header.txt
Show 6 quoted lines
> Beside that, I would recommend to set up a .gitatrributes file > and add it to the repo. > echo "* text=auto" >.gitattributes > > git add --renormalize . > git commit -m "Normalize line endings"
I am building a tool to analyze codebases, such as which function is moved from one file to another. Different line endings fail string equality.
Admittedly I can make a local commit to normalize all files. But it's best if a simple config `core.eol` can work.