git unignore被忽略目录的子目录

时间:2018-08-13 10:50:44

标签: git

我正在尝试为Wordpress网站设置gitignore文件。这是我到目前为止的内容:

# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!/wp-content/

# Ignore everything in the "wp-content" directory, except the "plugins"
# and "themes" directories.
/wp-content/*
!/wp-content/plugins/
!/wp-content/themes/

# Ignore everything in the "plugins" directory, except the plugins you
# specify (see the commented-out examples for hints on how to do this.)
/wp-content/plugins/*
!/wp-content/plugins/coemans-site-plugin/

# Ignore everything in the "themes" directory, except the themes you
# specify (see the commented-out example for a hint on how to do this.)
/wp-content/themes/*
!/wp-content/themes/bg-mobile-first/

这对于plugins文件夹工作正常,但仅添加bg-mobile-first文件夹,而不添加其内容。如果我将bg-mobile-first替换为主题文件夹(创世纪)中的另一个主题,则会添加整个文件夹及其中的所有内容。

我是git的新手,所以我可能缺少明显的东西,但是我已经搜索了一段时间,还没有找到解决方案。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

我尝试为另一个站点创建一个新的仓库,并且该仓库正在按预期工作,因此请考虑将其关闭。