我想忽略分支中的某些文件,而不必依赖在.gitignore与其他分支合并期间将被覆盖的跟踪文件.
我一直密切关注Stack Overflow的回答以及链接的博客帖子,但我的回购似乎并没有认识到excludesfile我的指定.git/config.Git文档(git-config,gitignore)似乎没有显示如何指定和寻址特定分支的排除文件.
我.git/config看起来像这样:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
excludesfile = +/info/exclude
[branch "myspecialbranch"]
excludesfile = +/info/exclude_specialbranch
Run Code Online (Sandbox Code Playgroud)
我的.git/info/exclude文件看起来像这样(默认情况下,我没有触摸它):
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude …Run Code Online (Sandbox Code Playgroud)