忽略git项目上的任何'bin'目录

生来就可爱ヽ(ⅴ<●) 提交于 2020-08-14 06:43:28

问题:

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
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!