What to Commit?

There are many different ways to structure a WordPress project in a Git repository. Some people will commit the full installation. Some people like to commit the wp-content directory including all plugins and themes. Personally I recommend keeping each theme and plugin in its own repository.

Transcript

In this video, we're going to talk about how to structure your WordPress projects with Git, and then, more specifically, we're going to talk about what to commit and especially what not to commit.

To sum it up, you need to keep every theme and plugin you work on in its own Git repository. The reason I'm saying this is because each theme and plugin is its own entity and, logically, it just makes a lot more sense to have it in its own Git repository and it's going to make your life easier.

I've seen different ways that people structured their WordPress installs with Git, and the most common I've seen is people committing the whole WordPress installation to one Git repository, and that approach is just fundamentally broken, and it's really not your concern to keep WordPress under version control because it's already done by someone else, so it doesn't really give you any benefits.

I wrote an article about this on the WP Tavern, and if you want to check it out, just Google Git and WordPress. I think it's one of the first results on Google, and I talked about it here, how you need to treat your WordPress plugins and theme with respect.

Just one more time: You need to keep all of your plugins and themes in their own separate repositories. You need to treat them as separate entities just like WordPress does.

That's all for this video. Thanks for watching.

All Lessons

Level up with WP Pusher

Take the pain out of WordPress development. Manage your code with Git and never again deploy files over FTP.

When I came across WP Pusher, I knew I had found the answer and it's now a vital part of our workflow!

Ashley Hart, Green Chilli
GitHub user, runs his local WordPress agency with WP Pusher

WP Pusher makes deploying changes to our websites quick and easy. We could not manage without it.

Simon Appleby, Bookswarm
Bitbucket user, manages 100+ WordPress sites with WP Pusher