3

I have some files stored in git that has LF endings. Somehow it got converted to CRLF in my working tree. I want to renormalize it, i.e. convert it back to LF. Other answers have led me to believe I could use git add --renormalize but it simply doesn't do anything:

$ git config --global core.autocrlf
input

$ git check-attr -a myfile
myfile: text: auto

$ file myfile
myfile: ASCII text, with CRLF line terminators

$ git add --renormalize myfile
$ git status
On branch master
nothing to commit, working tree clean

$ file myfile
myfile: ASCII text, with CRLF line terminators

What am I missing? I'm using Git 2.28.0.

Timmmm
  • 88,195
  • 71
  • 364
  • 509
  • 2
    `git add` never modifies the file in your working tree in any way, it just updates the index (i.e. how the file will be *committed*). You'd have to modify the file's line endings, **then** use `--renormalize` to correct the faulty index. – Romain Valeri Oct 01 '20 at 15:57
  • Ah ok. Guess I have another question then... https://stackoverflow.com/questions/64159070/how-to-renormalize-line-endings-in-my-working-directory – Timmmm Oct 01 '20 at 16:00

0 Answers0