问题:
I have a directory structure like this: 我有这样的目录结构:
.git/
.gitignore
main/
...
tools/
...
...
Inside main and tools, and any other directory, at any level, there can be a 'bin' directory, which I want to ignore (and I want to ignore everything under it too). 在main和tools以及任何其他目录中的任何级别上,都可以有一个“ bin”目录,我想忽略该目录(我也想忽略该目录下的所有内容)。 I've tried each of these patterns in .gitignore but none of them work: 我已经在.gitignore中尝试了每种模式,但是它们都不起作用:
/**/bin/**/*
/./**/bin/**/*
./**/bin/**/*
**/bin/**/*
*/bin/**/*
bin/**/*
/**/bin/* #and the others with just * at the end too
Can anyone help me out? 谁能帮我吗? The first pattern (the one I think should be working) works just fine if I do this: 如果这样做,第一个模式(我认为应该起作用的模式)就可以正常工作:
/main/**/bin/**/*
But I don't want to have an entry for every top-level directory and I don't want to have to modify .gitignore every time I add a new one. 但是我不想每个顶级目录都有一个条目,也不想每次添加新目录时都必须修改.gitignore。
This is on Windows using the latest msysgit. 在Windows上使用最新的msysgit。
EDIT: one more thing, there are files and directories that have the substring 'bin' in their names, I don't want those to be ignored :) 编辑: 还有一件事,有些文件和目录的名称中有子字符串“ bin”,我不想忽略它们:)
解决方案:
参考一: https://stackoom.com/question/6AYu/忽略git项目上的任何-bin-目录参考二: https://oldbug.net/q/6AYu/ignoring-any-bin-directory-on-a-git-project
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4492922