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.
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.
git add wp-content/plugins/particular_plugin/*, and push it plugin by plugin.