How can I disable diff in line separators in IntelliJ IDEA?

后端 未结 5 1042
失恋的感觉
失恋的感觉 2021-02-04 02:00

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

5条回答
  •  生来不讨喜
    2021-02-04 02:16

    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

提交回复
热议问题