Netbeans 和 Git,.obj 文件被忽略

Netbeans and Git, .obj files ignored

我正在处理一个涉及 .obj 文件的小型 git 项目。

当我查看 "project tab" 时,我发现它们被忽略了

但我不明白为什么,如果我看看我的 .gitignore:

/DepthPeeling/nbproject/private/
/DepthPeeling/dist/
/DepthPeeling/build/

看起来不错

如果我打开 Git Bash 并输入

$ git add dragon.obj
The following paths are ignored by one of your .gitignore files:
DepthPelling/sry/depthPeeling/data/dragon.ogj
Use -f if you really want to add them.
fatal: no file added

唔?

会不会不止一个.git忽略文件?如果我查找它们,我只会在项目本身的根目录中找到一个(我之前显示的那个),仅此而已..

编辑:看起来我有一个全局忽略 D:\Documents\gitignore_global.txt

#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.dll
*.lib
*.sbr

您可以使用 git check-ignore:

轻松找到哪个 .gitignore(以及哪个规则)负责忽略您的 .obj 文件
git check-ignore -v -- dragon.obj

OP 报告:

"D:\Documents\gitignore_global.txt":5:*.obj –

即相似to this comment:

it was the installation of SourceTree (a tool visualize git repo) which un-logically created under documents folder a gitignore_global.txt which included plenty of exclusions.

A git config -l 应该显示类似于:

[core] 
   excludesfile = C:\Users\username\Documents\gitignore_global.txt