.gitignore 文件告诉 Git 哪些文件和目录要忽略 — 不在版本控制中追踪。它用于排除生成的文件、依赖项、机密信息和不应被提交的特定环境文件。
.gitignore 的作用
# .gitignore — patterns of files Git should NOT track
node_modules/ # dependencies (reinstalled from package files, don't commit)
dist/ # build output (generated, don't commit)
*.log # log files
.env # ⚠️ SECRETS / environment variables — NEVER commit!
.DS_Store # OS-specific junk
.vscode/ # editor config (often personal)
build/
coverage/
*.tmp
Git 忽略匹配这些模式的文件 — 它们不会出现在 中,不会被暂存,也不会被提交。
