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
相关推荐
github.com/starRTC3 小时前
Claude Code中英文系列教程17:将Claude Code集成在GitLab工作流里面
git·gitlab·github
CCC:CarCrazeCurator5 小时前
git merge与rebase的区别及实操心得体会
git
草莓熊Lotso6 小时前
Qt 控件美化与交互进阶:透明度、光标、字体与 QSS 实战
android·java·开发语言·c++·人工智能·git·qt
小明同学016 小时前
[C++进阶]深入理解二叉搜索树
开发语言·c++·git·visualstudio
muddjsv6 小时前
Git Amend 完全解析:修改最近提交的正确姿势与避坑指南
git
ssxueyi6 小时前
Git 完整安装与环境配置教程(Windows/macOS/Linux 通用)
windows·git·macos·项目管理·git教程·代码管理
摇滚侠7 小时前
在 IDEA 中,GIT 合并分支时选择远程的 dev 分支和本地的 dev 分支,有区别吗
java·git·intellij-idea
可问春风_ren7 小时前
Git命令大全
前端·javascript·git·后端
Shine°8 小时前
git切换登录账号(解决 403 权限问题)
git
wdfk_prog9 小时前
Git文件状态显示异常的解决方案
大数据·git·elasticsearch