Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Martin Murphy
Martin Murphy
19,321 Points

Wordpress Deployment & Workflow

Hi everyone,

I have been looking through lots of different posts and can't find one definite solution. Is there a correct way / workflow for working with Wordpress and git. Whether to migrate databases, what to store in your git repo.

I found that there are multiple ways people do it but if anyone has a tried and trusted solution I'd love to hear it because I don't really know how to go about this.

Thanks in advance.

Martin

1 Answer

Austin Whipple
Austin Whipple
29,725 Points

Hi Martin,

You're correct that there are a whole lot of different ways to go about this and the best one for you may not be best for everyone. It definitely depends on the project and people you're working with to establish the best workflow, decide whether to keep an entire site in your repo instead of only the theme/plugin, and how often to sync databases.

For me as a single developer managing multiple sites on a managed WordPress host:

  1. I have a local copy of my repos and a second stored on Github used as "origin."
  2. The hosting service has a git integration that allows git push production master to run all server-side stuff necessary to launch any changes with just that one command.
  3. I track only the site themes in their respective repos and manage updates through the dashboards. If I'm worried about an upgrade breaking something it's a matter of first updating my dev environment for testing and then upgrading production. No technical reason you couldn't track the entire WordPress directory in git if you wanted to deploy core or plugin upgrades like theme updates.
  4. I sync databases and upload directories only when it's critical to have production content on my local copy for the purposes of development or testing. There are a host of plugins available to help with migrating databases. Local by Flywheel is also a very handy tool for setting up and managing local sites.

Anyway, that's just one way to go about it for someone that works mostly solo and focuses on theme development. Be prepared to adjust to suit your or your team's needs.

A handy couple of articles available at https://premium.wpmudev.org/blog/git-for-wordpress-development/ if you're interested in another use case.