简体   繁体   English

gitignore无法忽略某些目录下的文件

[英]gitignore unable to ignore files under certain directories

How do I ignore all folders/files under audit directory? 如何忽略审核目录下的所有文件夹/文件?

I tried adding **/audit to .gitignore which is present in the root of my project. 我尝试将**/audit添加到项目根目录中的.gitignore。 where .git is present but the file is still getting displayed in unstaged changes in eclipse. 存在.git的位置,但该文件仍在Eclipse的未暂存更改中显示。 Is it because of the - in file name? 是不是因为-在文件名?

data/test/audit/portfolio-tnc/TEST-2019-04-22T03-20-31.json

If the file is already tracked by git you have to remove it from git index 如果该文件已经被git跟踪,则必须将其从git索引中删除

git rm --cached data/test/audit/portfolio-tnc/TEST-2019-04-22T03-20-31.json

This will not remove the file but git won't track it anymore. 这不会删除文件,但是git将不再跟踪它。

You can untrack a whole directory with 您可以使用以下方法取消跟踪整个目录:

git rm -r --cached data/test/audit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM