.gitignore reference

This reference shows suggested .gitignore files to use in a development system and in a build or production system.

.gitignore for development

We recommend you use the .gitignore provided with Magento in a development system with the following changes—comment out the following so they are included in source control:

  • pub/media/*
  • pub/media/wysiwyg/*.*

    Show `.gitignore` for development
    /.buildpath
    /.cache
    /.metadata
    /.project
    /.settings
    /.vscode
    atlassian*
    /nbproject
    /robots.txt
    /pub/robots.txt
    /sitemap
    /sitemap.xml
    /pub/sitemap
    /pub/sitemap.xml
    /.idea
    /.gitattributes
    /app/config_sandbox
    /app/etc/env.php
    /app/code/Magento/TestModule*
    /lib/internal/flex/uploader/.actionScriptProperties
    /lib/internal/flex/uploader/.flexProperties
    /lib/internal/flex/uploader/.project
    /lib/internal/flex/uploader/.settings
    /lib/internal/flex/varien/.actionScriptProperties
    /lib/internal/flex/varien/.flexLibProperties
    /lib/internal/flex/varien/.project
    /lib/internal/flex/varien/.settings
    /node_modules
    /.grunt
    /Gruntfile.js
    /package.json
    /.php_cs
    /.php_cs.cache
    /grunt-config.json
    /dev/tools/grunt/configs/local-themes.js
    /pub/media/*.*
    !/pub/media/.htaccess
    /pub/media/attribute/*
    !/pub/media/attribute/.htaccess
    /pub/media/analytics/*
    /pub/media/catalog/*
    !/pub/media/catalog/.htaccess
    /pub/media/customer/*
    !/pub/media/customer/.htaccess
    /pub/media/downloadable/*
    !/pub/media/downloadable/.htaccess
    /pub/media/favicon/*
    /pub/media/import/*
    !/pub/media/import/.htaccess
    /pub/media/logo/*
    /pub/media/theme/*
    /pub/media/theme_customization/*
    !/pub/media/theme_customization/.htaccess
    /pub/media/wysiwyg/*
    !/pub/media/wysiwyg/.htaccess
    /pub/media/tmp/*
    !/pub/media/tmp/.htaccess
    /pub/media/captcha/*
    /pub/static/*
    !/pub/static/.htaccess
    
    

/var/* !/var/.htaccess /vendor/* !/vendor/.htaccess /generated/* !/generated/.htaccess .DS_Store </pre> </div> </div>

For reference, here is a link to the latest Magento .gitignore

.gitignore for build and production

You should use the same .gitignore in both your build and production systems so they have the same files in source control.

Changes compared to the default .gitignore:

  • The /pub/media/*.* directory is included in source control
  • The /pub/media/wysiwyg directory is included in source control
  • The /pub/static/*.* directory is included in source control
  • The /generated directory and subdirectories are included in source control

    Show .gitignore for build and production
    /.buildpath
    /.cache
    /.metadata
    /.project
    /.settings
    /.vscode
    atlassian*
    /nbproject
    /robots.txt
    /pub/robots.txt
    /sitemap
    /sitemap.xml
    /pub/sitemap
    /pub/sitemap.xml
    /.idea
    /.gitattributes
    /app/config_sandbox
    /app/etc/env.php
    /app/code/Magento/TestModule*
    /lib/internal/flex/uploader/.actionScriptProperties
    /lib/internal/flex/uploader/.flexProperties
    /lib/internal/flex/uploader/.project
    /lib/internal/flex/uploader/.settings
    /lib/internal/flex/varien/.actionScriptProperties
    /lib/internal/flex/varien/.flexLibProperties
    /lib/internal/flex/varien/.project
    /lib/internal/flex/varien/.settings
    /node_modules
    /.grunt
    /Gruntfile.js
    /package.json
    /.php_cs
    /.php_cs.cache
    /grunt-config.json
    /dev/tools/grunt/configs/local-themes.js
    /pub/media/*.*
    !/pub/media/.htaccess
    /pub/media/attribute/*
    !/pub/media/attribute/.htaccess
    /pub/media/analytics/*
    /pub/media/catalog/*
    !/pub/media/catalog/.htaccess
    /pub/media/customer/*
    !/pub/media/customer/.htaccess
    /pub/media/downloadable/*
    !/pub/media/downloadable/.htaccess
    /pub/media/favicon/*
    /pub/media/import/*
    !/pub/media/import/.htaccess
    /pub/media/logo/*
    /pub/media/theme/*
    /pub/media/theme_customization/*
    !/pub/media/theme_customization/.htaccess
    /pub/media/wysiwyg/*
    !/pub/media/wysiwyg/.htaccess
    /pub/media/tmp/*
    !/pub/media/tmp/.htaccess
    /pub/media/captcha/*
    # /pub/static/*
    !/pub/static/.htaccess
    
    

/var/* !/var/.htaccess /vendor/* !/vendor/.htaccess

/generated/*

!/generated/.htaccess .DS_Store</pre> </div> </div>