From ca575d629718318d0bc8b1b2d9dad835e2801f8f Mon Sep 17 00:00:00 2001 From: lzh Date: Fri, 24 Apr 2026 13:31:32 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=8A=A0=20.gitattributes=20=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=20Java/SQL/shell=20=E7=AD=89=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=A1=8C=E5=B0=BE=E4=B8=BA=20LF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 仓库历史存在零星 CRLF 文件(Windows 编辑器保存导致),每次他人修改都会出现 整文件 diff 污染 git blame。显式规则让 git add 自动规范化,避免复现。 *.bat/*.cmd/*.ps1 保留 CRLF(Windows 原生脚本语义要求),二进制类型显式 binary 阻止任何转换。 Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitattributes | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..3558463f --- /dev/null +++ b/.gitattributes @@ -0,0 +1,49 @@ +# 统一文本文件行尾为 LF,避免 Windows 编辑器把 LF 变 CRLF 污染 diff / git blame +* text=auto eol=lf + +# 源码类:显式标记,拒绝 autocrlf +*.java text eol=lf +*.kt text eol=lf +*.groovy text eol=lf +*.xml text eol=lf +*.yaml text eol=lf +*.yml text eol=lf +*.json text eol=lf +*.properties text eol=lf +*.md text eol=lf +*.sql text eol=lf +*.sh text eol=lf +*.py text eol=lf +*.ts text eol=lf +*.tsx text eol=lf +*.js text eol=lf +*.vue text eol=lf +*.html text eol=lf +*.css text eol=lf +*.scss text eol=lf +Jenkinsfile text eol=lf +Dockerfile text eol=lf + +# Windows 专用脚本保持 CRLF +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# 二进制类:禁止任何转换 +*.jar binary +*.class binary +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.pdf binary +*.zip binary +*.gz binary +*.so binary +*.dll binary +*.exe binary +*.woff binary +*.woff2 binary +*.ttf binary +*.eot binary