Windows换行符配置
默认(使用CRLF)
# git默认配置
git config --global core.autocrlf true
使用linux一样的(LF)
#提交时转换为LF,检出时不转换
git config --global core.autocrlf input
#拒绝提交包含混合换行符的文件
git config --global core.safecrlf true
IDEA/Pycharm设置使用UNIX换行符
设置File -> Settings
Editor -> Code Style
Line separator (for new lines) ,选择:Unix and OS X (\n)
对已使用Windows换行符的文件,可以使用Sublime Text打开,
View->Line Endings,选Unix,保存;
vscode的设置 文件->首选项->设置
搜索->Eol->设置默认行尾字符为\n
linux批量替换文件为lf
find . -type f -exec dos2unix {} \;
idea/pycharm先选中项目根目录
然后点击File-File Properties-Line Separators-LF
这样能把项目中所有的文件换行符都改为LF
windows
https://waterlan.home.xs4all.nl/dos2unix/zh_CN/man1/dos2unix.htm#9
https://waterlan.home.xs4all.nl/dos2unix.html#UNIX2DOS
scoop install -g dos2unix
for /R %G in (*.py) do dos2unix “%G”
for /R %G in (*) do dos2unix “%G”