.gitignore /文件夹与文件夹/
之间有什么区别
/bin
在 .gitignore 中,使用和
bin/
,我将如何制作它以便删除某个文件,无论它在哪里?
*/*.ext
in .gitignore what is the difference between using
/bin
and
bin/
And how would I make it so that it removes a certain file, no matter where it is?
*/*.ext
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
前导
/
将忽略模式锚定在树中特定.gitignore
所在的位置。尾随
/
表示模式仅匹配一个目录(以及该匹配目录中的所有文件)。您可以同时拥有两者,例如
/bin/
将仅匹配名为bin
的目录,并且仅在.gitignore
文件级别匹配。简单的
*.ext
将匹配任何位于其出现的.gitignore
文件级别或以下的以.ext
结尾的文件。A leading
/
anchors the ignore pattern at the point in the tree where the particular.gitignore
resides.A trailing
/
means that a pattern will only match a directory (and so all the files in that matching directory).You can have both, e.g.
/bin/
will match only a directory calledbin
and only at the level of the.gitignore
file.A simple
*.ext
will match any file ending with.ext
anywhere at or below the level of the.gitignore
file in which it appears.我测试了这些案例以及更多案例,您可以在此处查看结果:
编辑:根据下面@Dan Breen 的评论进行更正(谢谢!)
I tested the cases and also some more ones and here you can review the results:
EDIT: Corrected according to @Dan Breen's comment below (thanks!)
后者将匹配任何其他子目录中的“xxx/bin”和“bin”。
回答您的编辑:
*.ext
将处理存储库中以该扩展名结尾的所有文件。The latter would match "xxx/bin" and "bin" in any other subdirectories.
Answer for your edit:
*.ext
would take care of all files in the repository ending w/ that ext.