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
相关推荐
Bitup_bitwin3 小时前
Git智能合并机制深度解析
git
TeleostNaCl9 小时前
OpenWrt 编译 | 一种使用 git submodule 方式实现一键更新多个外部软件包
网络·经验分享·git·智能路由器
Cosmoshhhyyy1 天前
mac环境下安装git并配置密钥等
git·macos
yuwei0211 天前
git大全解
git
小林的技术分享1 天前
版本控制系统-Git 学习 《progit》电子书学习记录 第一章 (仅隔个人学习记录用)
git
weixin_456904271 天前
Git登录配置的详细方法
git
鄃鳕1 天前
Git , 本地落后远端
git
Yusei_05232 天前
迅速掌握Git通用指令
大数据·git·elasticsearch
qq_377572772 天前
git commit - revert + reset + checkout + reorder
git
2301_767233222 天前
Git使用和理解上的一些问题
git