I have this in my root folder of my repo as .gitignore. However, the file at the end is not ignored.
/*.*
wp-content/*
wp-admin/*
wp-includes/*
cgi-bin/*
well-known/*
# Files to not ignore
!/.gitignore
# Unignore theme folder
!wp-content/themes
!wp-content/themes/*
# Unignore plugins folder, but ignore all content
!wp-content/plugins
wp-content/plugins/*
# Unignore only cmpz folders
!wp-content/plugins/cmpz-*
wp-content/plugins/cmpz-product-feed/xml/google-shopping/feed-roof-tents.xml
Is there a problem that plugin folders starting with "cmpz-" are not ignored? However, how could I ignore files in subdirectories?
Putting the files in the gitignore file is the first step. But the files and folders in your git version control do not just delete themselves. Even if you have added them to the .gitignore.
The second step would be to delete the files that are already in the repository. You can easily do that with this:
git rm -rf --cached .
git add .
Don't forget to commit all changes before you do this!