git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Why doesn't git core.eol=lf work?

From
JCJason 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.
Previous: Torsten BögershausenNext: Johannes Sixt
Message 3 of 7 in “Why doesn't git core.eol=lf work?”
  1. Jason ChoJul 12, 2025
  2. Torsten BögershausenJul 12, 2025
  3. Jason ChoJul 12, 2025
  4. Johannes SixtJul 12, 2025
  5. Jason ChoJul 12, 2025
  6. Lidong YanJul 13, 2025
  7. Jason ChoJul 13, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.