Wildcard gitignore文件夹中具有扩展名的文件
我试图让git忽略所有扩展名为.ex的文件,但前提是这些文件位于名为subf的子文件夹中。在这本书中,我读到了以下内容:Wildcard gitignore文件夹中具有扩展名的文件,wildcard,gitignore,subdirectory,Wildcard,Gitignore,Subdirectory,我试图让git忽略所有扩展名为.ex的文件,但前提是这些文件位于名为subf的子文件夹中。在这本书中,我读到了以下内容: 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,
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
的文件!我在线程中读到应该将排除规则添加到文件.git/info/exclude
。这似乎对我有用,但我不满意,因为这不是我理解.gitignore
的方式。有人能帮我理解为什么在.gitignore
中放置**/subf/*.ex
不起作用吗。谢谢大家! 为什么不简单到
subf/*.ex
或者,如果您希望在任何级别使用subf
**/subf/*.ex
它对我有用