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 community
Assuming 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
/phpserver to ignore list.
git clonemake sure to execute
rm -rf .gitjust after that)
composer updatein the Magento root
.gitignore, but it is better to add the following 2 as well
/phpserver(just add these 2 lines to .gitignore)
.gitignorein the root of Magento.)
app/code/YourCompanyName/YourModuleName), now you will have only your custom code in your git repository
.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:
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.