The .git/info/exclude file has the same format as any .gitignore file. Another option is to set core.excludesFile to the name of a file containing global patterns.
Note, if you already have unstaged changes you must run the following after editing your ignore-patterns:
git update-index --assume-unchanged <file-list>
Note on $GIT_DIR: This is a notation used all over the git manual simply to indicate the path to the git repository. 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.
Another way is to use:
无标题闪念 · 2023年11月1日
GIt 本地忽略路径
The
.git/info/excludefile has the same format as any.gitignorefile. Another option is to setcore.excludesFileto the name of a file containing global patterns. Note, if you already have unstaged changes you must run the following after editing your ignore-patterns:Note on
$GIT_DIR: This is a notation used all over the git manual simply to indicate the path to the git repository. 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. Another way is to use:Reverse it by:
参考:How do I configure git to ignore some files locally? - Stack Overflow