Magento 2 gitignore
Before shedding light on Magento 2 gitignore files, we’d like to draw your attention to Git itself. Being a free and open source software, this version control system is developed to help you with all possible projects from basic small to complicated large ventures. Git is easy to learn and master, powerful, and full-featured solution, which outperforms such SCM tools as Subversion, Perforce, or CVS. Moreover, you can easily learn it right in your browser via
Table of contents
Magento 2 gitignore purpose
The purpose of every gitignore file is to specify intentionally untracked files that should be ignored by Git. Please note that Git can already track some files, so they won’t be affected. To stop tracking a currently tracked file, use the following command:
1 |
git rm --cached |
Magento 2 gitignore structure
All gitignore files consist of a various number of lines, each of which specifies a pattern. Git checks these patterns to decide what path to ignore. The following order is utilized: a precedence from the highest to lowest levels. In case of a single precedence level, Git relies on the last matching pattern to produce the outcome.
Git ls-files, git read-tree, as well as other underlying Git plumbing tools, read gitignore patterns specified by CLI options. Alternatively, they can be specified from files specified by such options. As for git status, git add, and other higher-level Git tools, they rely on patterns from sources specified
Magento 2 gitignore pattern format
- A blank line can be utilized as a separator which increase readability, since it matches no files.
- Start a line with # to leave a comment. If you have a pattern which begins from #, place \ before the first #.
- Since trailing spaces are ignored by default, you should use \ to make them valid.
- ! is an optional prefix that negates the pattern, but if you have a matching file which is excluded by a previous pattern, it will become included again. Note that it is impossible to include a file one more time if its parent directory is excluded. Directories are not excluded by Git for performance reasons. If you have a pattern that starts with !, place \ before the first !.
- If a slash is used on the end of a pattern, it is removed for the following description purpose.
- As for patterns without a slash, Git treats them as a shell glob patterns. It checks for a match against the pathname corresponding to the .gitignore file location.
For further information on gitignore pattern format, check the official documentation:
Magento 2 gitignore file
You can find the most reliable gitignore file for Magento 2 here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
/.buildpath /.cache /.metadata /.project /.settings atlassian* /nbproject /sitemap /.idea /.gitattributes /app/code/Magento /app/design/*/Magento /app/etc /app/i18n/magento /app/*.* /bin /dev/shell /dev/tests/*/framework /dev/tests/*/testsuite/Magento /dev/tests/*/tmp /dev/tests/*/etc /dev/tests/*/*.* /dev/tests/*.* /dev/tests/api-functional/config /dev/tests/api-functional/_files/Magento /dev/tests/js/JsTestDriver/framework /dev/tests/js/JsTestDriver/testsuite/lib /dev/tests/js/JsTestDriver/testsuite/mage /dev/tests/js/JsTestDriver/*.* /dev/tests/js/jasmine/assets /dev/tests/js/jasmine/spec_runner /dev/tests/js/jasmine/tests/app/code/Magento /dev/tests/js/jasmine/tests/lib/mage /dev/tests/js/jasmine/*.* /dev/tests/performance /dev/tests/functional/lib/Magento /dev/tests/functional/tests/app/Magento /dev/tests/functional/testsuites/Magento /dev/tests/functional/utils /dev/tools/Magento /dev/tools/grunt /dev/tools/*.* /dev/*.* /lib /pub /setup /var /vendor /*.* !/composer.json !/composer.lock !/README.md |