简体   繁体   中英

Using .gitignore to only include specific directories and their subdirectories

I am using a Git repo for my Wordpress starter kit with all my plugins and themes when starting a project.

Currently I have to delete all files I don't want by hand and I would like to automate this with .gitignore.

What need to be included:

/wp-content/themes/ and all the subdirectories in here /wp-content/plugins/ and all the subdirectories in here

My question is: how can I do this using .gitignore on a complete Wordpress install?

I have found similar questions on Stackoverflow, but I didn't find any answers that include all subdirectories.

Thanks in advance!

Try this:

!wp-content/themes/
!wp-content/plugins/

Keep in mind the trailing slash is important.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM