1.Git設置
git config --global core.autocrlf false
git config --global core.safecrlf true
含義:
AutoCRLF
#提交時轉換爲LF,檢出時轉換爲CRLF
git config --global core.autocrlf true
#提交時轉換爲LF,檢出時不轉換
git config --global core.autocrlf input
#提交檢出均不轉換
git config --global core.autocrlf false
SafeCRLF
#拒絕提交包含混合換行符的文件
git config --global core.safecrlf true
#允許提交包含混合換行符的文件
git config --global core.safecrlf false
#提交包含混合換行符的文件時給出警告
git config --global core.safecrlf warn
2.IDE設置使用UNIX換行符
IDEA的設置File -> Settings
Editor -> Code Style
Line separator (for new lines) ,選擇:Unix and OS X (\n)
對已使用Windows換行符的文件,可以使用Sublime Text打開,
View->Line Endings,選Unix,保存;