我想让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
的方式。有人能帮我理解为什么在.gitignore
中放置**/subf/*.ex
无效吗?谢谢!