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
相关推荐
炸膛坦客5 小时前
Git 和 GitHub:(十四)rebase 到某个有新提交的远程仓库的分支
git·github
炸膛坦客19 小时前
Git 和 GitHub:(十二)基于远程仓库的某一个分支的某一笔提交创建新分支
git·github
炸膛坦客20 小时前
Git 和 GitHub:(十三)改分支名
git·github
他们叫我秃子20 小时前
Git 使用指南笔记:从入门到团队协作
git
铁锚1 天前
Git设置自动推送到同名远端分支
git
起个破名想半天了1 天前
Git 本地项目关联远程仓库教程
git·github·git教程
lazy H1 天前
Git worktree 怎么用?同时开发多个分支完整教程
大数据·git·后端·学习·搜索引擎·github
重生的黑客1 天前
Git 本地版本管理与分支管理:从零理解工作区、回退、冲突与开发流程
数据库·git·elasticsearch
Cx330_FCQ2 天前
Tmux使用
服务器·git·算法
xxwl5852 天前
Git 完整学习笔记:从入门到团队协作
笔记·git·学习