gitignore 目录和子目录中的所有文件(特定文件类型)

gitignore all files (specific filetype) in a directory and subdirectories

忽略某个目录及其所有子目录中的某个文件类型的正确方法是什么?

示例:忽略 master/xyz/ 中的所有 .xml 文件和 master/xyz/ 中的所有子目录。

我不确定以下两种方法中哪一种是正确的...

master/xyz/*/*.xml

master/xyz/**/*.xml

我应该使用哪一个?

(我用的是Git 1.9.1)

您可以添加类似这样的内容,它将在 git 1.8.2.1(文档 here

后运行

A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.

# should work
master/xyz/**/*.xml

您发布的第一个建议无效,因为它不匹配任何内容(因为它是文字)

# wont work
master/xyz//.xml