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

.gitconfig 增加如下部分

bash 复制代码
[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

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

bash 复制代码
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
相关推荐
cxxx1710 小时前
【同步Overleaf, Github】
git·overleaf
染翰12 小时前
Linux root用户安装配置Git
linux·git·后端
老虎海子12 小时前
从零手搓一个 AI 编程助手:Mini Claude Code 完全指南
人工智能·git·vscode·python·github
Cat_Rocky12 小时前
CICD-Git简单学习 操作流程后续补
git·学习
存在的五月雨12 小时前
Git的操作
git
丶Darling.12 小时前
Git 初学者使用手册
git
乐于分享的阿乐14 小时前
Git下载安装与零基础使用完整教程
git
东北甜妹14 小时前
DevOps 和 Git,Gitlab
git·gitlab·devops
console.log('npc')14 小时前
git发版上线的时候,打tag标签方便jenkins部署
运维·git·jenkins
日晨难再15 小时前
SVN使用笔记
笔记·svn