Keeping WP database synced across multiple developers using git

I’m working on improving my git workflow as it applies to my WordPress development projects. Often, when developing a content management system, I’ll create a development server (like http://dev.finalsitename.com) containing the custom post types and taxonomies that will be used in the production version. This allows my client to begin adding their content to the site.

While they are working on this task, I’m usually building out the look and feel as well as the custom programming/plugins that will be used on my localhost environment. To ensure that I don’t overwrite any of their updates, I generally pull a copy of their database down and replace mine. However, there are times where I just need to hop into the WP admin area and change a setting or something else small…

If there are multiple developers working on a WordPress project, we each do a (timestamped) database dump of our version of the site and include in in the root directory before committing and pushing their local branch back to the remote repository. The trouble with this approach is that the databases are often out of sync with no easy way to determine which to use.

What are other developers doing to keep their databases in sync while still allowing multiple developers (and clients/content producers) to work on the same project?

4

There are 3 options from easiest –>

  1. Use only one remote database that you all connect to with lots of backups. That way you just have to worry about files and not the db.

  2. Use the import and export functionality built into WordPress and throw it into your version control right into the wp root (like in a new folder). Sure it takes an extra few minutes but its dead simple and you can automate it, but more importantly it will become part of the version control.

  3. Use a custom updating script to version the actual database sync. I honestly don’t know how you can manage that with git because its a just a script and doesn’t really know what is going on, I know there are 3rd party tools that do this commercial and free ( http://www.liquibase.org/).

Leave a Comment