I've installed magento2
via composer. I couldn't find any information about common gitignore files for magento2 and the the file structure is still strange to me.
Can someone share a common gitignore template? Thanks!
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityAssuming that project was created using
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .
take this .gitignore and put into your project root. It also makes sense to add /update
and /phpserver
to ignore list.
Another option:
git clone
make sure to execute rm -rf .git
just after that)composer update
in the Magento root.gitignore
, but it is better to add the following 2 as well /update
and /phpserver
(just add these 2 lines to .gitignore).gitignore
in the root of Magento.) app/code/YourCompanyName/YourModuleName
), now you will have only your custom code in your git repositorycomposer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition <installation directory name>
?
– Alex Paliarush
Nov 20 '15 at 15:13
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition .
– Claudiu Creanga
Nov 20 '15 at 15:14
vendor/magento/magento2-base/.gitignore
does not ignore core files, unlike this one github.com/magento/magento2-community-edition/blob/master/… . I suppose it will be added automatically in scope of future releases of M2
– Alex Paliarush
Dec 4 '15 at 11:36
Your .gitignore
should depend on your deployment process. If you use composer install in production then it makes sense to have the vendor folder ignored, but it is very risky:
http://www.letscodejavascript.com/v3/blog/2014/03/the_npm_debacle
If you don't have some other strategies for deployments I would commit the vendor folder and not run composer in production.
Also I removed grunt folder from gitignore, imo it should be tracked because you have changes to themes.js file etc.
I normally use the following website to generate my gitignore:
For my magneto2 projects I had used git ignore from.
https://dev2devs.com/magento-tips-and-tricks-for-developers-and-server-admins/