git and svn 行尾风格配置强制为lf

git

CLI配置:

// 提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true   

// 提交时转换为LF,检出时不转换
git config --global core.autocrlf input   

// 提交检出均不转换
git config --global core.autocrlf false
图形配置:

进入setting, 点git

git and svn 行尾风格配置强制为lf_第1张图片

 .gitconfig 增加如下部分

[core]
	autocrlf = input

svn

svn:eol-style

  • LF: Set end-of-lines automatically to Unix line endings upon checkout and commit.
  • CRLF: Set end-of-lines automatically to Windows line endings upon checkout and commit.
  • native: This will store line endings upon commit to Unix line endings (LF), but will checkout the line endings with either LF or CRLF based upon the client.

图形配置实例:

win11 :  TortoiseSVN setting

git and svn 行尾风格配置强制为lf_第2张图片

默认有# enable-auto-props = yes,放开#号,并增加对应的你使用的文件配置

enable-auto-props = yes
# Add these for each text file type that you use:
*.txt = svn:eol-style=native
*.cs = svn:eol-style=native
*.xml = svn:eol-style=native
*.c = svn:eol-style=native
*.h = svn:eol-style=native
Makefile = svn:eol-style=native

你可能感兴趣的:(git,svn)