2

The fresh Magento installation brings a lot of files and folders to the table. When I measure, it takes like ~150MB. However, I don't think we need them all in VCS (i.e. git), because I can always gather them by composer.

I believe that we should only commit app/code, composer.json and composer.lock. But, I am not 100% sure.

Do you think that I would ever need to change other files for some reason? What is the best practice that the community follows on this topic? Which files do you submit to the VCS, and why?

Cheers,

1 Answer 1

1

I hope VCS means Version Controls. By default, Magento itself has .gitignore file and which recommends what are the folders we don't need to commit, please refer this https://github.com/magento/magento2/blob/2.3/.gitignore

e.g)

  1. /pub/media/. -> It means git will not track any files inside pub/media/*
  2. !/pub/media/.htaccess -> It means git will track only pub/media/.htaccess changes not whole pub/media/* beacuse in first condition we remove pu/media/* from git track.
  3. /vendor/* -> It means git will not track any files inside folder vendor/*

(You are correct) Generally, we are following like only commit app/code/, app/design/, composer.json and composer.lock files to the server. We will get the full package from composer install and composer update.

4
  • So, in this case, I really don't need to commit other files. You said "generally", do you have any exception case that you can think of? Commented Mar 31, 2020 at 12:31
  • 1
    No exception case, it is the best practice to follow. Even Magento cloud also following the same practice. Commented Mar 31, 2020 at 12:33
  • Do you have a page which shows that Magento Cloud requires only composer files and app/ directory? Commented Mar 31, 2020 at 12:35
  • 1
    refer this github.com/magento/magento-cloud/blob/2.3.4/.gitignore Commented Mar 31, 2020 at 12:42

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.