5

In Drupal 8, perhaps the most anticipated feature is separation of configuration from content. It achieves this by storing configuration changes in a sites/default/config_* folder.

Why then does the default .gitignore file suggest ignoring this directory?
If I make changes to the site, I want those changes to be tracked to push them to the live site, or merged with another developer's changes.

3
  • If you want to add an exception to include your site config folder in the main Drupal repo, I found adding this line works: !sites/*/files/config_whateverrandomstring (no trailing slash or asterisks)
    – Derrick
    Jan 9 '14 at 2:54
  • Have no idea why Drupal even ships with a .gitignore - the choice of version control has nothing whatsoever to do with Drupal. I had expected it to be removed in 8.
    – rix
    Aug 3 '14 at 11:08
  • @Derrick your exception doesn't run if you don't add an asterisk to the main ignored folder: This is OK: > sites/default/files/* > !sites/*/files/config_whateverrandomstring This is NOT OK > sites/default/files/ > !sites/*/files/config_whateverrandomstring
    – calbasi
    Feb 21 '19 at 20:08
3

You are supposed to put that in a separate repository, I suppose. Note that the best practice workflow is to export the configuration and git the staging directory. You are not supposed to edit the active directory to the best of my understanding.

Edit: since writing this answer the default storage is now in the database and there's no more active directory.

5
  • That makes sense! Thanks. Though for a small site, I'm not convinced the additional repo and export/staging step is worth the extra effort so I think I will just keep everything in one. Change config? git add, git push, done. New core updates? Git pull/merge, done. Though certainly not as clean as separating into two repositories - theoretically its a simpler and faster workflow.
    – Derrick
    Jan 9 '14 at 2:51
  • 1
    You must only add the staging directory and copy the files from active to it. The import process is required so systems can re-act to configuration changes (like creating the necessary field tables when you add a new field).
    – Berdir
    Jan 9 '14 at 8:46
  • 2
  • That said, adding the staging directory to the same repository is IMHO fine. The .gitignore does not specifically mention the config directories at all, they're just excluded together with all other files, which is correct. It is now quite easy to move the config folder outside of files and only ignore the active directory.
    – Berdir
    Jan 9 '14 at 8:50
  • Ohhhhh.... that bursts my bubble - was expecting/hoping that Drupal reacts to file changes in the active config folder in real-time, thus allowing a pure Git workflow to pull/merge from other developers. Thx for clarifying Berdir. I guess this workflow is almost achieved, just need to run a drush command to export config before a commit, and then again to import after pulling a commit.
    – Derrick
    Jan 9 '14 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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