WordPress Gitignore

Wondering how git fits into your WordPress dev workflow? Here’s a great little file to help you get started – WordPress gitignore. Don’t know what a gitignore file is for? Read up on the gitignore file on the git manual.

This version of my .gitignore for WordPress assumes you want to manage your WordPress git repository from the root of the site (there are arguments as to whether or not you really want to do this, but that’s for another post).

Basically it ignores WP core files and any themes and plugins not explicitly marked to not ignore. For example, you don’t want to check in the code for the Yoast SEO plugin… because you aren’t actively working on that code and it’s silly to waste space checking it in (plus it becomes a headache to manage updates from Yoast). But if you have a plugin you wrote specific to your site you can use the WordPress gitignore file to explicitly commit those files to your repository.

The same goes for themes. You don’t want the TwentyFourteen theme in your repository because it’s not code you are working on. However if you have created a TwentyFourteen child theme then you’ll want that included in the repository and you should tell the WordPress gitignore file to include it.

WordPress Gitignore

Do you use a different method in your WordPress gitignore file? Let us know how you work in the comments.