I just updated some plugins (woocommerce, polylang) of a local copy of a running wordpress website. As I'm using git I wanted to commit the changes and sync with the live-host. But the problem is, that the updates also updated the database. Now I'm a bit confused, because if I sync now with git the database won't be updated on the live system as for example woocommerce asks me to trigger the database update once I have updated the plugin. On the other hand, I saw in other people's .gitignore file, that no one ignores wp-content/plugins. I could also dump the local database and insert into the live systems, but the data is too different.

My plan right now is to update on live first, make a git commit and sync with the local copy - if the local copy gets broken I'll pull in the database and a fresh copy from the live system. The big disadvantage here is, that for future updates your testing systems becomes the live-system, in other words, no testing before updates. You see I'm really confused about how to do that.

So my question is how to update WordPress plugins properly using git? How do you folks handle this?

  • are you tracking your database in git? How did a git commit change your database? Git only tracks files, I think there are significant gaps in your question with differences between what you're doing and what you've written driven by some assumptions nobody else is aware of. Try and assume we have no idea what you're talking about, and rid yourself of the idea there is a "standard" way of doing things that you tried to follow, and just explain your system in its entirety – Tom J Nowell Feb 11 '19 at 12:51
  • The database is not in git. When I update a plugin on system A, the plugin will update the code and the database, but only the code will be in git. When I sync now with host B I will update the code using git, but not the database. And as the code has been synced with the most current version of the plugin I'm afraid, that the plugin will not try to update the database and I'll have a inconsistency. – manifestor Feb 11 '19 at 12:55
  • Why would the plugin update the DB automatically on A but not on B? Are you doing something hacky that would mess with it? If there is an inconsistency why's that an issue? Just pull down the production data to your local, local environments regularly "desync". It sounds like what you needed to do was just do it and see what happens, but you wanted reassurance instead – Tom J Nowell Feb 11 '19 at 12:57
  • Maybe because this process is triggered during update. – manifestor Feb 11 '19 at 12:59
  • Well then, download the zip of the new updated plugin, and manually update it rather than using the built in updater, and find out that way. Suffice to say this is an issue I have never encountered or had to worry about – Tom J Nowell Feb 11 '19 at 12:59

No it's fine, lots of hosts depend on plugins being stored in git this way and it isn't an issue.

You can replicate the process by manually updating a file locally to test. Plugin authors tend to store a database version field, and update if it's mismatched, or they rely on functions such as dbdelta which auto-update table schema

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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