I am using a version control system to manage my wordpress code (git). What is the betst way to store the database information into version control?

I want to go to my staging machine, run git pull to get the latest code from my development machine, then maybe click one button or something like that to update the DB to match what I have on my development computer.

I also want a way to, on my stage machine, "merge" the my development DB with the production DB before pushing all of that to production.


  1. how to update a DB after a git pull
  2. how to "merge" DB information.

1 Answer 1


This is more a git question than a WordPress one IMHO, but what you need to do is write a bash script and associate with a git hook that does what you want.

  • I'd be interested in hearing how you went with this, @Alexander Bird. Perhaps you might want to add an answer with what you ended up with?
    – Tim Malone
    Commented May 12, 2016 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.