如何使用gitignore忽略通配符文件夹结构

时间:2017-06-07 10:20:06

标签: wordpress git wildcard gitignore

/wp-content/

的示例文件夹结构
/
/plugins
/plugins/akismet
/plugins/gravityforms
/plugins/woocommerce
/plugins/woocommerce-call-for-price
/plugins/woocommerce-dropdown-cart
等等......

我如何使用gitignore忽略所有与woocommerce相关的文件夹,而无需手动完成所有文件夹?

我在想/plugins/woocommerce-**之类的东西,但老实说我不知道​​。

这是我目前的gitignore文件

# Start default WordPress gitignore 
https://github.com/github/gitignore/blob/master/WordPress.gitignore
*.log
wp-config.php
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
wp-content/upgrade/
wp-content/uploads/
wp-content/wp-cache-config.php
wp-content/plugins/hello.php

/.htaccess
/license.txt
/readme.html
/sitemap.xml
/sitemap.xml.gz

# Ignore root files/folders as they are only changed with WP updates which we don't care to track
wp-admin/
wp-includes/
index.php
wp-activate.php
wp-blog-header.php
wp-comments-post.php
wp-config.php
wp-cron.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php
README.md

# Ignore everything in wp-content apart from themes as this is essentially the WD
/wp-content/*
!/wp-content/themes
!/wp-content/themes/*

# Allow certain plugins through gitignore
!/wp-content/plugins/*
/wp-content/plugins/*
!/wp-content/plugins/woocoomerce

0 个答案:

没有答案