So, having read through:

... I'm still not sure what is best way to go when setting up a D8 project with git.

modules and themes

Apparently, the contributed/ custom modules and themes folders have moved from D7:




in D8. When I copy modules to /sites/all/modules D8 does recognize them. But when I add modules via Admin UI, they get downloaded to /modules So, which folder to git? Is it generally bad practice now to go for sites/all?

Formerly, we had this file and git structure (D7):

↳ www.example.com
  ↳ sites
    ↳ all -> /repo/repo.git/all
↳ repo
  ↳ repo.git
    ↳ all

Now, I imagine it way more complex:

↳ www.example.com
  ↳ modules -> /repo/repo.git/modules
  ↳ themes -> /repo/repo.git/themes
↳ repo
  ↳ repo.git
    ↳ modules
    ↳ themes

just for the modules and themes.

This leads me to the question: what about sites/default/files/conf*?

I understand that this folder is being used for the configuration files, but:

  • is it right that my local dev environment and the staging/ prod environments have their very own folder?
  • is the usage of configuration files necessary when we only tend to have one "real", always up-to-date main database (prod/live)?
  • should the conf be tracked and deployed with git? Why?

Thanks a lot!


Drupal comes with an example .gitignore file, just rename "example.gitignore" to .gitignore and you have a pretty good starting point. It also comes with a lot of explanations.

Many of your questions go way beyond just answering that should be added to get, there are also some different opinions.

  • Yes, put your modules in /modules and so on, it's a lot easier to work with.

  • Whether or not to commit /vendor depends on your deployment process. if you deploy your git repository directly and have no intermediate deployment process, you probably still want to commit the vendor directory. There are various alternatives, starting from just building an archive yourself and deployment that, to automating that with scripts/build tools to using solutions like platform.sh that run composer install automatically for you. If you use any of those, you likely want to ignore vendor as the example .gitignore file does by default.

  • It's also common practice to have a settings.local.php and add settings.php to git, see instructions in settings.php at the end.

  • I don't understand your repo.git and repo folder examples. It's not more complex than in Drupal 7, just different folders.

  • Yes, you probably want to move your config folder out of files (you need to update the path in settings.php) and commit it. You shouldn't only have one environment, and config allows you to make changes on one site, export it and import it on production. There are many questions here and documentations about this available.

| improve this answer | |

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.