This is a collection of .gitignore files I find useful for assorted projects. There are other larger, more comprehensive collections of .gitignore files, but these are the .gitignore configurations I use and find useful.
I have not made any effort to modularize them.
A .gitignore file for PHP applications using Composer. This tracks the composer.lock file as recommended in Composer's documentation.
.gitignore for PHP library projects using Composer. This does not track the composer.lock file; Composer's documentation does not make a recommendation one way or the other here, but library projects should try to keep their requirements minimal IMO.
This is the .gitignore file I use for WordPress repositories. It has worked well so far for sites that have a custom theme but manage plugins through WordPress's usual built-in update mechanisms.
This is designed to not track WordPress components that update themselves:
- You allow WordPress to self-update, or you update it from a third-party system;
- You then make a code update in your WordPress repository and push the update;
- The push does not break the updates installed in the site.
Some WordPress shops try to track entire WordPress sites in Git. This does not work well. WordPress works better when treated as a "platform" for smaller, independent software projects. Each individual project (plugin, theme, or other) should be tracked in its own repository, but not tracked in the WordPress sites using them.
All plugins are ignored.
Only the base WordPress themes are ignored. Custom themes with a built-in update mechanism may end up tracked here, which could cause complications.
Rules are included to ignore cruft added by operating systems, IDEs, utilities, and loggers, as well as filetypes that WPEngine doesn't support when pushing to their remotes.