我正在开发一个涉及 .obj 文件的小型 git 项目。
当我查看“项目选项卡”时,我发现它们被忽略了
但如果我查看我的 .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
Wut?
可能有多个 .gitignore 文件吗?如果我寻找它们,我只能找到项目本身根目录中的一个(我之前显示的那个),仅此而已。
编辑:所以看起来我有一个全局忽略 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
您可以轻松找到哪个.gitignore
(以及哪条规则)负责忽略您的.obj
文件使用git check-ignore http://git-scm.com/docs/git-check-ignore:
git check-ignore -v -- dragon.obj
OP 报告:
"D:\\Documents\\gitignore_global.txt":5:*.obj –
那是类似的对此评论 https://stackoverflow.com/a/18703637/6309:
这是安装源树 https://www.atlassian.com/software/sourcetree/overview(一个工具可视化 git repo),它在文档文件夹 a 下不合逻辑地创建gitignore_global.txt
其中包括大量的排除项。
A git config -l
应显示类似以下内容:
[core]
excludesfile = C:\\Users\\username\\Documents\\gitignore_global.txt
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)