4

Is it good practice to push vendor folder into git repository? Is there any pros and cons of it?

1
  • bad prcatice, you can commit composer.lock only instead of all vendor
    – Max
    Mar 2, 2018 at 14:30

2 Answers 2

3

That depends on your deployment strategy

For instance, we never run composer in staging or production servers, so any composer update or install of new packages are always done in developers local environments

Under a scenario like ours, vendor folder is included in git repository. We included app/etc/config.php file also. I posted a similar question some time ago. You can read there Magento2 - local / staging / production deployment & gitignore about other approaches, involving some interesting tools

1

One of the ideas presented that works is to commit the entire vendor directory and make the changes to the file and commit to the repo. Lets analyze this for a moment. It works and on deployment the vendor directory will be pushed with changes, Yet the git repo has all the files from vendor in it.

Ideally this should be excluded and composed as part of a build. Also if we run a composer update then there is a chance that unless we ping our composer versions the changes just get nuked every time. There feels like a potential for merge conflicts on changing packages and its just another area of the project that ideally we use composer to manage.

More detail refer link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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