子目录中的 gitignore 不允许列入白名单的条目

gitignore in subdirectory is not allowing a whitelisted entry

git 与 .gitignore 位于子目录("web" 文件夹)中。以下 git忽略代码给我带来了一些问题。

**/app/themes/  #Should ignore all folders in the themes subdirectory
!*/app/themes/folder1  #allow one single folder and it's content to be versioned

我尝试了一些组合,例如 /app/themes 和 */app/themes -- 如果有任何帮助,我们将不胜感激!提前致谢!!

我觉得你想做

app/themes/**
!app/themes/folder1 

这将匹配路径 url/app/themes 中的所有文件。您在第一行中的内容是:匹配所有名为 themes 的文件夹,它们是 app 的子文件夹,无论在哪里 应用 。 你不会只拥有

app/themes

因为那样会忽略整个文件夹,并且不允许在后面的行中进行否定。