A sample .gitignore for WordPress projects
Recently, I’ve been dealing with changing how I manage version control on most of my plugins and themes. Historically, I’ve had all of wp-content in Git, updated locally, and pushed everything.
Unfortunately, that gets a boatload of other people’s code in my version control. It’s big, and it makes my own stuff harder to navigate. It’s also annoying, because it makes it harder to just manage regular updates of other folks’ plugins on my actual site.
What I’ve decided to do is instead ignore everything in wp-content but my own custom plugins.
Josh Eaton, of Reaktiv Studios, has a handy .gitignore file to use as a template to help think through a scenario like this, if you would like to use a similar system.
This is also handy for situations where your host auto-updates plugins on the live environment, but not commercial ones or your custom ones. You can ignore everything but your custom plugins and your commercial plugins in that case.