Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
rockswang
wild-work
Repository navigation
Code
Issues
5
(5)
Pull requests
1
(1)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
wild-work
/
.gitattributes
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
32 lines (30 loc) · 1.46 KB
master
Breadcrumbs
wild-work
/
.gitattributes
Copy path
Top
File metadata and controls
Code
Blame
32 lines (30 loc) · 1.46 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#
统一行尾:仓库内一律存 LF,检出也一律给 LF。
#
#
为什么需要(2026-10-19 实录):
#
本仓此前没有任何行尾约束,core.autocrlf 也未设置,于是 Git 按字节原样存取。
#
结果 macOS/Linux 侧的文件是 LF(462 个),而远端有 6 个文件被 Windows 侧工具
#
存成了 CRLF。当两侧都改同一个文件时,Git 逐行比较会认为**每一行都不同**,
#
报成整文件冲突:internal/app/app.go 一次合并因此冒出 8698 行冲突,实际真实
#
改动只有 2 处。这会把真正的逻辑冲突埋掉,也让 git blame / diff 失去可读性。
#
#
规则说明:
#
text=auto —— 让 Git 自动识别文本文件(二进制自动排除,如图标/图片)。
#
eol=lf —— 入库与检出都用 LF。比 eol=crlf 更省事:Windows 上的编辑器
#
(VS Code / GoLand / Vim)都原生支持 LF,不会显示异常。
#
#
落地配套:`git add --renormalize .` 把已存在的 CRLF 文件一次性洗成 LF,
#
见同批提交。此后任何人提交都会被规范化,CRLF 不会再进仓库。
*
text
=
auto
eol
=
lf
#
明确标记二进制,避免被当文本做行尾转换(转换会损坏文件)。
*
.png
binary
*
.jpg
binary
*
.jpeg
binary
*
.gif
binary
*
.ico
binary
*
.icns
binary
*
.zip
binary
*
.gz
binary
*
.woff
binary
*
.woff2
binary
#
锁文件与生成物:即使将来工具写成 CRLF 也不参与 diff 噪声
package-lock.json
text
eol
=
lf
You can’t perform that action at this time.