Git Workflow for Large, Live Site?

(I realize this question is five years old, and that the OP probably found a solution already.)

I work on a team that manages a large WordPress website. We have tens of thousands of custom posts, with data being entered/edited dozens if not hundreds of times a day.

We actually break things down a little bit, with git repos for the website theme (where most of the custom development happens) and for each custom plugin we write. We don’t make any code edits to the WP core, so no version control is needed for it.

We use a Git Feature Branch workflow for both themes and plugins. There are a lot of guides to feature branch workflows, but at a very basic level, we have a master (production) branch and a develop (UAT/staging) branch. All new features/issues are branched off of develop, and once they are done, are merged back into develop. Develop is merged into master whenever we want to release any new features. (Pretty similar to what is shown here: https://nvie.com/posts/a-successful-git-branching-model/.)

We use GitHub for both code review (feature branches are pushed to GitHub, and then a Pull Request is issued into develop, where the review happens before merging in) and as our “source of truth” for each theme/plugin.

For deployment of our themes/plugins, we use WP Pusher on both our staging and production servers. It connects directly with GitHub, and you can deploy any of your branches almost instantaneously. There are other command line solutions out there that work, e.g. Deployer, but for WordPress, I really don’t see anything better than WP Pusher at the moment.

We don’t work with production data locally, and instead make use of a lot of dummy data for testing. In the event production data is needed locally (e.g. to debug a rare issue), we just export the MySQL database and import it locally. There are quite a few ways of doing this so I won’t go into any detail. It would be very risky to push locally edited databases back up to the server. There are just way too many ways for this to go wrong. Our live production database is always the source of truth for us. (Just make sure you have some automated DB backup system in place.)

Leave a Comment