CR, LF, CR / LF for the line feed used on different operating systems:
- Windows / DOS system: CR / LF represent the next line;
- Unix / Linux system: LF represent the next line;
- Mac OS System: A CR indicates that the next line;
- Mac OS X system: LF represents the next line (Mac OS X has been changed, and Unix / Linx as using LF).
Git default when submitting the Windows line feed (CRLF) is converted to LF, the UNIX line feed (LF) CRLF replaced when pulling.
In keeping code consistent use of government projects
LF
as the only line breaks.
git configuration
Turn off automatic line break conversion
// 提交检出均不转换 git config --global core.autocrlf false
Open line breaks check
// 拒绝提交包含混合换行符的文件 git config --global core.safecrlf true // 允许提交包含混合换行符的文件 git config --global core.safecrlf false // 提交包含混合换行符的文件时给出警告 git config --global core.safecrlf warn
Compiler configuration
- vsCode compiler to configure the default line break
- Open settings, user settings, a text editor, document, the Eol (default line characters) to '\ n'
- Or "setting.json" file, add
{ "files.eol": "\n" }
- webstrom compiler set the default line break
- setting => Editor => Code Style, Line separator set
Unix and OS X (\n)
- setting => Editor => Code Style, Line separator set