drupaldrupal-8drushdrupal-9

Drush cim proper workflow


We have a DRUSH CEX set under config/sync folder. Our 2 developer are working on the same project. Now here's the situation

  1. Dev 1 ran drush cex and his config was exported
  2. Dev 2 had a few changes in the CMS but didn't run drush cex
  3. Dev 1 push his config export to git repository
  4. Dev 2 pulled the changes from the git
  5. Dev 2 tried running drush cim but it won't let him because it will overwrite whatever he have in the local and it will be lost.
  6. Dev 2 tried to backup the config by running drush cex but it will then override whatever is in the GIT REPOSITORY. Meaning changes of Dev 1 will be overwritten by Dev 2 changes.

Now question is how can we go around this? We want both dev to have all their changes committed at the same time imported to the cms. But we can't fix this.

Can anyone please help us on the proper work flow of drush please


Solution

  • Can happen yes but only occasionally if two devs happen to work on the same config files.

    Approach 1: Dev 2 exports config before pull and manually resolves later merge conflicts before config import

    So before Dev 2 pulls the changes they first need to export config. Then pull. Then resolve any merge conflicts. And only now import configs.

    Approach 2: Dev 2 exports config after pull and manually git resets unrelated changes before config import again

    Alternatively Dev 2 exports config after pull and git resets everything that's not related to the feature they are currently working on (that's best practice anyways). And now imports config again.