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
相关推荐
第七种黄昏6 分钟前
零开始git使用教程-传html文件
git
一笑code29 分钟前
git常用命令
大数据·git·elasticsearch
弘毅 失败的 mian1 小时前
Git 基本操作
大数据·经验分享·笔记·git·elasticsearch
wang6021252182 小时前
Git相关操作
git
点亮~黑夜4 小时前
git详细使用教程
大数据·git·elasticsearch
bin91534 小时前
当AI化身Git管家:初级C++开发者的版本控制焦虑与创意逆袭——老码农的幽默生存指南
c++·人工智能·git·工具·ai工具
hello1114-4 小时前
Git 学习打卡Day1-基础、高级、远程仓库初步
git·学习·github
鸽鸽程序猿4 小时前
【Git】分支管理
git
青衫码上行4 小时前
分布式版本控制系统Git的安装和使用
分布式·git·svn
.豆鲨包4 小时前
【Git】Git的配置与使用(非常详细)
git·github