Power's Wiki

Power's Wiki -

Using gitignore to ignore special files

Using gitignore to ignore special files There are some files that we do not want to include in Git version control, nor do we want them to always appear in the untracked list, such as node_modules, some development dependencies, compilation logs, and so on. In this case, we can create a .gitignore file and list the items that need to be ignored. Specification Empty lines or lines starting with the comment symbol # will be ignored Standard glob pattern matching Matching patterns followed by a backslash (/) indicate that the directory should be ignored To ignore files and directories other than the specified patterns, add ! before the pattern to negate it Example ```gitignore This line is a comment and will be ignored by Git Ignore all .a files *.a Do not ignore lib.a !lib.a Ignore the TODO file in the root directory /TODO Ignore the build folder build/ Ignore all txt files in the doc directory (excluding subdirectories) doc/*.txt Ignore all txt files in the doc directory (including all subdirectories) doc/*/.txt ``` Reference and Acknowledgement zxhfighter/git-ignore.md github/gitignore This post is translated using ChatGPT, please feedback if any omissions.

介绍如何使用.gitignore文件忽略不需要纳入Git版本管理的文件,包括规范和示例,如空行、注释行、glob模式匹配和目录忽略等。

.gitignore Git 忽略文件 示例 规范

相关推荐 去reddit讨论

热榜 Top10

LigaAI
LigaAI
观测云
观测云
Dify.AI
Dify.AI
eolink
eolink

推荐或自荐