.gitignore
一句话解释
.gitignore file 列表模式 for files and directories 那个 Git 应该 intentionally 不 track.
用大白话说
.gitignore file tells Git 哪个 files and directories 到 skip. 每个行 是 glob 模式. Files matching 模式是 不 shown in git status and cannot be accidentally committed.
Common things to ignore: build output (dist/, 构建/), dependencies (node_modules/), secrets (.环境, *.键), OS files (.DS_Store, Thumbs.db), and editor configs (.vscode/, .idea/).
Patterns: * matches any characters, ** matches any directories, a trailing / means directory only, a leading / means root only, and ! negates a pattern (un-ignore). The .gitignore file itself should be committed so all team members share the same ignore rules.
示例
text
# .gitignore example
node_modules/
*.env
build/
dist/
.DS_Store
*.log
# Negate: track this .env file even though *.env is ignored
!.env.example模式 tell Git 哪个 files 到 skip. ! negates 模式.
相关术语
相关资源
相关课程
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。