我试图让git忽略扩展名为.ex的所有文件,但前提是它们位于名为subf的子文件夹中。在男人gitignore我读了以下内容:
Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning:
· A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or
directory "bar" anywhere that is directly under directory "foo".
但是,如果我将**/subf/*.ex
放入.gitignore
(在存储库基本目录中),则不会忽略.ex
扩展名的文件!我在this帖子中读到我应该将我的排除规则添加到文件.git/info/exclude
。这似乎对我有用,但我对它不满意,因为这不是我理解的.gitignore
。有人可以帮助我理解为什么**/subf/*.ex
无效.gitignore
。谢谢!
答案 0 :(得分:1)
为什么不那么简单,
subf/*.ex
或者如果你期望任何级别的subf,
**/subf/*.ex
这对我有用