I’m working on a wordpress plugin as part of a larger project. The wordpress install sits in a wordpress folder, I want to ignore all of the wordpress install except the specific plugin that I’m working on, so everything in the plugin folder, and all subfolders need to be included.
This is what I’ve got so far
wordpress/
!wordpress/
wordpress/*
!wordpress/wp-content/
wordpress/wp-content/*
!wordpress/wp-content/plugins/
wordpress/wp-content/plugins/*
!wordpress/wp-content/plugins/my_plugin
This works to ignore all the wordpress stuff except the my_plugin folder. Everything I’ve read suggests that the last line should be some form of !wordpress/wp-content/plugins/my_plugin/* or !wordpress/wp-content/plugins/my_plugin/** but not only does that not work, it makes the my_plugin folder disappear from the list of changed files entirely. !wordpress/wp-content/plugins/yourbookng_listing_plugin/ works the same as !wordpress/wp-content/plugins/yourbookng_listing_plugin, the folder appears but none of the files or subfolders
If its relevant, I’m using github desktop.
2
Answers
The
.gitignore
file is parsed from top to bottom, so you should rewrite it as follow:It seems like you’re trying to set up a .gitignore file to exclude everything in your WordPress installation except for your specific plugin. Here’s how you can modify your .gitignore file to achieve this:
This should make sure that everything in your WordPress installation is ignored except for your my_plugin folder and its contents. Make sure to adjust the paths accordingly if your folder structure is different. After modifying your .gitignore file, make sure to commit the changes and push them to your GitHub repository.