I am new to Drupal and I am using Drupal 7.61.

Should the Drupal modules folder be git ignored or included in the source code management for best practices and continuous integration sake?

  • 2
    This article should give you a better idea: morpht.com/blog/… (disclaimer: I'm the author of that article) – Jaypan Dec 7 '18 at 5:51
  • It depends... It's a rather opinion-based thing. And wether you manage your project via Composer for example. – leymannx Dec 7 '18 at 11:44

As Jaypan and leymannx say in the comments above, if you use Composer to manage dependencies, you can just include composer.json and composer.lock in your version control repository. Then you can use Composer to rebuild your project when you deploy. This has the advantage of keeping all third party code out of your repo.


The documentation linked above shows how to use Composer to install Drupal core, contrib modules, and even patches and libraries.

This approach is the emerging standard. But it has its pros and cons. Here are some Drupal and Composer "gotchas" to look out for:


If you don't use Composer, it's probably a good idea to keep core, contrib, patches and libraries in version control.

| improve this answer | |

For Drupal, it is best practice to add settings.php, public, and private files to the .gitignore file like as following:

# Ignore configuration files that may contain sensitive information.

# Ignore paths that contain user-generated content.

You can learn more about source code management by using git from here:

| improve this answer | |
  • I didn't -1 but this is an extremely minimalistic opinion. If you'd like to drop a proper answer to this question, please explain how you come to your conclusion and a least name some possible alternatives. – leymannx Dec 7 '18 at 11:46
  • It doesn’t even discuss modules, or take into account projects using Drush Make or similar or build servers. – Kevin Dec 7 '18 at 12:31

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.