While switching a WordPress site onto Git I looked for a .gitignore template. But I stumbled upon a reoccurring theme.
Fact: you don’t want WordPress core files, or your server-specific configuration files etc., in your project’s repository. You just don’t. â Joe Bartlett
And the recommended GitHub .gitignore for WordPress excludes all wp-*.php files. WordPress.gitignore.
Why is this recommended? Surely Iâd want as many core files to be included as possible, otherwise I have to install WordPress on every server I deploy to.
If context helps, Iâm deploying it to a load balanced network with two application servers and two database servers.
The only thing I keep in a repository is the theme, never any core WordPress files. In the readmes I keep track of what versions it works with.
It’s probably not recommended to help discourage modifying the core files.
Another idea is to keep WordPress as a clean git repo with your themes as submodules, that way you can upgrade/rollback WordPress separate from your themes. This is also how I maintain sites that use frameworks.
This is recommended in order to keep only YOUR files into your repository. Then using a script (or something else) you can retrieve the WP sources.