diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..54b5f37 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,10 @@ +# 仓库内一律以 LF 存储、以 LF 检出。 +# +# 为什么必须锁死:线上(Linux)文件是 LF,仓库里存的也是 LF,但只要 +# core.autocrlf=true,`git archive HEAD` 就会把内容转成 CRLF 输出。 +# 于是「用 git archive 打的部署包 / 改动前后快照」与工作树逐字节不一致, +# 表现为「所有文件都不同」的假象,白排查半天。锁成 LF 后三者一致。 +# +# 注意:判断行尾别用 `grep -c $'\r'`(Git Bash 下 $'\r' 会被吞成空模式, +# 每行都命中 → 误判「全是 CRLF」)。用 Python 数字节:b.count(13)。 +* text=auto eol=lf