0

I am developing a website on Drupal with 2 other developers. What would be the best way to collaborate? We plan to work on different git branches and there will be a dev and production branch as well. How can we keep in sync with the database structure without overwriting each others' work?

1
  • Everything important is in configuration. Use version control.
    – Kevin
    Oct 27, 2022 at 13:00

1 Answer 1

1

It can be done with Drupal's configuration management system. Have a read of https://www.drupal.org/docs/configuration-management to get started

Essentially any site changes apart from content can be stored in .yml files which you can import/export on each environment (storing them in GIT)

I wouldn't recommend trying to synchronize content and this is better done manually on your dev/stage/prod environment. But if you really wanted to there is the default content module which allows for content to go into .yml files too https://www.drupal.org/project/default_content

4
  • 1
    Wouldn't it cause merge conflicts? If I and a new content type and other developer adds new custom block type. When he pushes a commit and I import the config, won't it cause merge conflicts/overwrite my changes? Oct 27, 2022 at 12:41
  • No because each config e.g. content type, field, block.... are in separate .yml files. So if everything is new it's unlikely to cause any conflicts as you'll be adding/editing separate .yml files. The only time you'd have an issue is if you both edited exactly the same thing like the label for a field. In that case, you'd get a GIT conflict but you'd just have to sort those out like any code conflict Oct 27, 2022 at 12:49
  • 1
    This is the correct answer. Merge conflicts are a part of life for developers but speaking from experience they are uncommon in configuration synchronization as long as you import the configuration on HEAD before working. The use-case in the question is the reason Drupal's configuration synchronization system exists.
    – cilefen
    Oct 27, 2022 at 12:49
  • Great. Thanks for explanation. Oct 27, 2022 at 12:53

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