Along with the growth of your project, you (as well as your colleagues) will feel the need to add thousands of files or directories. Git repository will track all the changes to ensure that all members are on the same page, but often, some of the changes should definitely be ignored due to their unimportant roles.
So how do you tell Git to do this ignoring task for you?
That’s when you need the help of Magento Gitignore. A Gitignore File contains patterns of files that should be intentionally untracked. Gigignore File used in Magento 2 is published with the source on Github as you can see below.
In order to see the list of all ignored files, simply run the command open.gitignore (on Mac) or start.gitignore (on PC). From there, you can add files and items that you explicitly want Git to ignore.
So which files should be ignored then? Pay close attention to the following files:
- /pub/media/*.*
- /sitemap
- /node_modules
- /package.json
- /pub/static/*
When applying changes on Magento Website, you might need to check if these files are on this list or not. In case that they are, you’ll have to update those files with Git Commit.
Read more:
How to Use AJAX Requests in Magento