1

How to handle wordpress core and plugin updates when using git? I need to update my core and plugins. I have site on my localhost and live site on server. If I update localy and then commit+push changes it breaks site because the live database is not updated. If I update live site I have no changes on localhost, and no way to test if update breaks site.

2
  • 2
    Do you have your whole installation in a single git repository? The way I do it is that each plugin and each theme that I'm working on is its own repository. That way I don't have to worry about core updates, other plugins' updates, etc, messing up my repositories.
    – Pat J
    May 14, 2018 at 14:14
  • 1
    Ideally you would export the database from the live server, import it on localhost and test the updated plugins. If everything is ok push the plugins to live server. You could also add the changes from just 1 folder using git add wp-content/plugins/particular_plugin/*, and push it plugin by plugin.
    – D. Dan
    May 14, 2018 at 14:15

1 Answer 1

2

In my readings (and as mentioned in OP comments) the best practice seemed to be focusing on the /wp-content/ folder, or specific custom contents therein. Syncing all the core files and third party plugins just causes headaches and unnecessary version monitoring.

I had troubles with this myself, but it's best to remove the mentality that repo act as a mirrored / complete backup, because (from reading & my own experience, as well as your post shows), it doesn't work well that way.

If it's just a handful of themes/plugins https://wppusher.com is an incredible tool to handle the deployment from git to production.

This old post stevegrunwell.github.io/wordpress-git/ is a good resource for defining the line between what to include and exclude for the local/git/live workflow. Most notably, slide 13 shares and awesome .htaccess rewrite to use remote media files so you're not always keeping local in sync.

Your Answer

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

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