7

I've just installed IntelliJ IDEA with git and pulled down code from the framework. Immediately after doing this, I get hundreds (out of thousands) of files saying that 'contents have differences only in line separators'. If I change these from CRLF to LF it makes no difference. Any idea how to fix this?

EricSchaefer
  • 25,272
  • 21
  • 67
  • 103
  • 1
    Did you [configure git line endings correctly](https://help.github.com/articles/dealing-with-line-endings/)? Any overrides via local `.git/config` and the user `.gitconfig`? What OS and git version do you use in IDEA? – CrazyCoder Feb 22 '17 at 18:33
  • 1
    Another possible reason is the `.editorconfig` file somewhere in the project that was used to apply the different code style. – CrazyCoder Feb 22 '17 at 19:02
  • https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration – duffymo Apr 24 '21 at 11:55

1 Answers1

3

One possible reason may be change of line separator style after your checkout, and a missed git reset after that. For example, if you change global config "core.autocrlf" or ".gitattributes" file, you may need to reset git index.

Backup your changes and execute those commands at the root of git repository to reset git index:

rm .git/index
git reset
Kartal Tabak
  • 760
  • 1
  • 7
  • 18
  • This is the exact problem I had, and this solution cleared up my problem completely. Thank you! – Joseph Pratt Jun 12 '23 at 02:32
  • Worked for me. I had to convert all the files in my project to UNIX format. I wanted to ignore all such changes from GIT changes. – Harsh Raj Jul 25 '23 at 11:15