Removing files from the repo after an update to use composer
Best practice says we shouldn’t be committing vendor, core or contrib projects to a repo, (see https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-...)
As a result I have had to go through the process of removing the files on several sites.
This can be done by running:
git rm --cached -r docroot/core/.
git rm --cached -r docroot/modules/contrib/.
git rm --cached -r docroot/themes/contrib/.
git rm --cached -r docroot/profiles/contrib/.
git rm --cached -r docroot/libraries/.
git rm --cached -r vendor/.
we also need to make sure these have been added to the .gitignore file
# Ignore drupal core.
docroot/core
# Ignore contrib modules. These should be created during build process.
docroot/modules/contrib
docroot/themes/contrib
docroot/profiles/contrib
docroot/libraries
#Composer vendor
vendor/
vendor/.git
Finally we may want to create .gitkeep files as placeholders to keep the folder structure in place.
touch docroot/modules/.gitkeep
touch docroot/themes/.gitkeep
touch docroot/profiles/.gitkeep
touch docroot/libraries/.gitkeep
Add new comment