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
相关推荐
Jooolin7 小时前
【编程史】Git是如何诞生的?这可并非计划之中...
linux·git·ai编程
Lw老王要学习12 小时前
VScode 使用 git 提交数据到指定库的完整指南
windows·git·vscode
去旅行、在路上12 小时前
Git & Svn
git·svn
冰淇淋分你一半12 小时前
window查看SVN账号密码
svn
abcnull12 小时前
github中main与master,master无法合并到main
git·github
养意18 小时前
git提交代码和解决冲突修复bug
git·bug
码农黛兮_461 天前
Git 常用命令大全
git
一弓虽1 天前
git 学习
git·学习
疯狂的沙粒2 天前
如何通过git命令查看项目连接的仓库地址?
大数据·git·elasticsearch
qq_254617772 天前
Gerrit+repo管理git仓库,如果本地有新分支不能执行repo sync来同步远程所有修改,会报错
git