Score:0

Including modules in Git repository

us flag

Non core third party modules are maintained in modules directory in the Drupal root directory. Should this directory be added to the .gitignore file?

If a module is upgraded in a Staging system then why would the module be managed in a site specific Git repository when no changes are intended and the module is maintained by a third party? Surely if the module is required in production then it is a case of simply installing the module once pulling is finished?

If composer is used, would it be sufficient to run composer update once code is pulled (including composer.json) to have any missing modules installed? I am assuming that this would ensure staging and production modules are kept synchronized without maintaining code in Git.

cn flag
Closing as dupe of the more canonical question as there's no difference between the vendor and modules/contrib folder in this context
Score:0
cn flag

This is totally up to you and how you want to manage your web server.

For example, among dedicated Drupal hosts, Platform.sh and Pantheon have you commit composer.json and composer.lock, and then they automatically build your site based on that. This has the benefit of keeping your git repo small.

But, if you have a simple site on shared hosting, it is sometimes easier to commit all the modules so that you can do git checkout and be done without worrying about build failures. Of course, this makes the repository much bigger.

In the end, I don't think there is a Drupal best practice about this because it is a question of build tools. However, composer states that their best practice is to not commit dependencies.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.