we are using the Magento default .gitignore for development.


(b.t.w. a similar version can be found here, but I would recommend the original from Magento: https://www.gitignore.io/api/magento2)

Question: why is the gitignore ignoring vendor/* files that may be installed and containing new/used extensions?

(we found out after installing an extension and wishing to commit the new code)

Appreciate it

References: Magento2 - local / staging / production deployment & gitignore

  • 1
    Not storing the vendor folder allows you/your developer to run composer update which pulls down the latest versions of the core libraries and any 3rd part extensions. if you dont want to have to keep pushing custom modules into repositiories you can add them under them app/code folder which does get stored within git but its all down to personal preference – Dava Gordon Apr 15 at 13:28
  • And how bad is it to "inlcude" the /vendor code already. Even if you do run composer update: wont it always check for new code anyways? – snh_nl Apr 15 at 13:41
  • yes but every time you run composer update it will update the code within the vendor folder but not on the repo so everytime u pull from master it will deploy your older version which will cause issues with module versions and code_base version which are defined within the magento database – Dava Gordon Apr 15 at 13:48
  • I understand. Difficult. But a full update is also not always wanted. So maybe including it sounds good but you should do it after each composer update as a habit. Or create a hook for git commit that ask if you want to execute a composer update prior? – snh_nl Apr 15 at 20:52
  • you can lock your composer file to specific versions, you can also include scripts as part of the update action on composer which will run after a successful update. i never recommend committing vendor bu i can only advise against it if you want to save vendor then that is up to you. – Dava Gordon Apr 16 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.