Kuniyoshi Kamimura
Kuniyoshi Kamimura

Reputation: 83

Change CRLF to LF of all the files in repo

My repo has lots of files with CRLF. I want them to be changed to LF.

I tried to change in my working copy and commit them but the changes are ignored by git. The files with only change eol can be staged but can't be committed, right?

I can change eol and add another change on the first commit then I revert the change except for eol before next commit. But it's so dirty solution.

Why does git ignore the eol changes? Any good workaround for this?

I know core.eol and core.autocrlf in config and * text=auto in .gitattributes but they don't help me.

Upvotes: 2

Views: 5258

Answers (1)

jloh
jloh

Reputation: 401

You have to refresh your repository after changing line endings after setting core.autocrlf. This can be done using

git add --renormalize .
git commit -m "Normalize all the line endings"

Upvotes: 5

Related Questions