From the relevant Git documentation :
(从相关的Git文档中 :)
Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (eg, auxiliary files that live inside the repository but are specific to one user's workflow) should go into the $GIT_DIR/info/exclude
file.
(特定于特定存储库但不需要与其他相关存储库共享的模式(例如,位于存储库内但特定于一个用户工作流程的辅助文件)应放入$GIT_DIR/info/exclude
文件。)
The .git/info/exclude
file has the same format as any .gitignore
file.
(.git/info/exclude
文件与任何.gitignore
文件具有相同的格式。)
Another option is to set core.excludesFile
to the name of a file containing global patterns. (另一个选项是将core.excludesFile
设置为包含全局模式的文件的名称。)
Note, if you already have unstaged changes you must run the following after editing your ignore-patterns:
(请注意,如果您已经取消暂存更改,则必须在编辑忽略模式之后运行以下命令:)
git update-index --assume-unchanged [<file>...]
Note on $GIT_DIR
: This is a notation used all over the git manual simply to indicate the path to the git repository.
(注意在$GIT_DIR
:这是一个符号使用遍布 git的手册只是为了表明路径git仓库。)
If the environment variable is set, then it will override the location of whichever repo you're in, which probably isn't what you want. (如果设置了环境变量,那么它将覆盖您所在的任何存储库的位置,而这可能不是您想要的。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…