How to disable diff in line separators in IntelliJ IDEA?

I am using Intellij IDEA 14 on Windows and Git as VCS on a Unix server. The line separator on Windows is CLRF ( \r\n ) and LF ( \n ) on Unix. In Git, I use config --global core.autocrlf input . This will translate all CRLFs to LF after commit.

When I use the "Reformat code" parameter in a well formatted file, IDEA marks the files as modified and shows the difference only in line separators.

Right mouse button on changed file -> Git -> Compare with Latest Repository Version

How to disable this in IDEA?

+7
java git intellij-idea diff
source share
3 answers

In the lower right corner of the window, change [CRLF] to [LF]

+3
source share

I also work on windows, because our servers are running Linux, and all the code must be based on Linux. I preferred to change all my files to LF instead of CRLF.

from git command line:

 git config --global core.autocrlf false 

I work with the idea of ​​intellij, so this is pretty easy:

1) File β†’ Settings β†’ Editor β†’ code style: (for any new file to be created)

but. Scheme: default

b. Line Separator: unix and os x (\ n)

2) mark the project root -> file -> line separator -> LF unix and os x (\ n) (for existing files)

Note. You can also use applications such as dos2unix.exe or some other scripts.

than I used my command line: (you can also do this from an idea)

 git commit -m "bla bla" git add . git push origin master 

since then I have not received these warnings

+1
source share

In Intellij 17.3, you can select in the Compare By field in the comparison window whether you want to compare Binary Content or Text. In the second case, CRLF and LF are not displayed as "different."

0
source share

All Articles