0

This question already has an answer here:

I am gradually getting the hang of using Git with WordPress but I have a question that's hopefully a simple answer.

I have set up my local environment which I am happy with and using BitBucket as a private repo.

I push to my staging server when I'm happy with my local development.

Then once the client approved the staging site, it's then pushed to production.

The client has access to the production site and may make changes to the blogs (I understand this is merely database work only) and uploads some pictures.

If the client asks for some changes to the style of the site, is it good practice to then pull the production version (new images etc) and pull the database using WP Db Migrate Pro back to my local server to start working and then proceed with staging to production as before?

Should I merely just pull the theme files if they want some theme changes? Or pull everything if they require me to upload new images etc.

marked as duplicate by Dave Romsey, cjbj, Max Yudin, fuxia May 16 '17 at 12:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

This is not specifically a GIT question so much as a development workflow question (GIT vs. SVN will produce similar WordPress workflows given the details you provided).

If the changes the client wants to make don't depend directly on specific DATA then you don't need to sync your PROD data down to your local environment for every change. For example, you can change the styles of your home page without relying on specific posts in the database.

The same goes for images stored in the media library. If the client just wants to see images aligned or styled in a specific way then you can demonstrate those changes with FPO graphics in your LOCAL or STAGING environments without a sync.

Here are a few things to consider when defining a workflow:

  • You can sync a clean copy of PROD or STAGING down to your LOCAL environment any time. Most of the time your local data will be disposable.
  • You should only sync from LOCAL up to STAGING (never up to PROD) in case your client needs to review changes you've made locally that rely on specific data being present in the DB.
  • Your PROD media library should be your "clean" set. Try to avoid loading images into PROD for testing purposes. Use LOCAL and STAGING for that.
  • If you can spring for a CDN that will ease a lot of burden of moving media assets around all over the place. Most cacheing plugins will reference your CDN assets via absolute URL regardless of your environment.
  • If you don't have a CDN in place, you should version control your media assets to make it easier to move them around. A CDN is a faster/cleaner solution but many people will still add version control anyway (for peace of mind).
  • Run backups on your PROD data often so you always have a recent recovery point. This is especially true of your DB and any assets not currently under version control.

A lot of this is more general advice to consider when defining a workflow that works for you. I hope the advice is helpful.

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