I'm using Intellij IDEA 14 on Windows and Git as VCS on Unix server. The line separator in Windows is CLRF (\r\n
) and LF (\n
) in Unix. In Git, I'm using config --global core.autocrlf input
. This will translate all CRLF's to LF's upon commit.
When I'm using "Reformat code" option on well-formatted file, IDEA marks files as changed and shows diff in line separators only.
How can I disable that in IDEA?
To open the Diff & Merge page, open settings by pressing Ctrl+Alt+S and navigate to Tools | Diff & Merge. Click this button to scroll both differences panes simultaneously. If this button is released, each of the panes can be scrolled independently.
CR and LF are control characters or bytecode that can be used to mark a line break in a text file. CR = Carriage Return ( \r , 0x0D in hexadecimal, 13 in decimal) — moves the cursor to the beginning of the line without advancing to the next line.
The line separator used by the in-memory representation of file contents is always the newline character. When a file is being loaded, the line separator used in the file on disk is stored in a per-buffer property, and all line-endings are converted to newline characters for the in-memory representation.
There are shortcuts for this in IntelliJ IDEA! Simply hit Shift+Enter to start a new line below the current line or Ctrl+Alt+Enter (⌥⌘Enter on Mac) to start a new line above the current line.
In the bottom right of your window, change [CRLF]
to [LF]
I'm also developing on windows and Because our servers are powered by Linux and all the code has to base on Linux I have preferred to change all my files to LF instead of CRLF.
from git command line:
git config --global core.autocrlf false
i'm working with intellij idea so it's quite easy:
1) File --> settings --> editor --> code style: (for any new file will be created)
a. Scheme : default
b. Line separator: unix and os x (\n)
2) mark the root of the project --> file --> line separator --> LF unix and os x (\n) (for exist files)
Remark: you can also use apps like dos2unix.exe or some other scripts.
than I did using my command line: (you can do this also from the idea)
git commit -m "bla bla" git add . git push origin master
since then, I didn't got those warnings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With