Luciano Nooijen
Luciano Nooijen

Reputation: 131

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!

Upvotes: 0

Views: 41

Answers (1)

justkidding96
justkidding96

Reputation: 548

Try this:

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

Keep in mind the trailing slash is important.

Upvotes: 1

Related Questions