查找 gitignore 文件和导致文件被 git 忽略的行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11764439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:17:25  来源:igfitidea点击:

Find gitignore file and line causing a file to be ignored by git

git

提问by idbrii

How can I find the gitignore file and line that is causing a file to be ignored by git?

如何找到导致文件被 git 忽略的 gitignore 文件和行?

回答by idbrii

From the repo root, try this:

从回购根,试试这个:

find . ~/.gitignore .git/info/exclude -name '*gitignore' -exec cat {} + | less

Also check that you're not using a different excludes file:

还要检查您没有使用不同的排除文件:

git config -l | grep exclude
core.excludesfile=~/.gitignore

You can also get that error when you have submodules in a subfolder instead at the git project's root.

当你在一个子文件夹,而不是在Git项目的根有子模块也可以得到这个错误

Thanks to Jon Linand Christopherfor helping me figure this out on the original question.

感谢Jon LinChristopher帮助我解决了最初的问题