.gitignore for Magento
29 ignore rules for Magento, ready to copy into your repository.
E-commerce platform
The complete .gitignore for Magento
# Generated by LFGitignore - https://lfgitignore.com
# Created: 2026-08-05 01:31:22 UTC
# Technologies: Magento
### Magento ###
/PATCH_*.sh
/app/etc/local.xml
/media/*
!/media/.htaccess
!/media/customer
/media/customer/*
!/media/customer/.htaccess
!/media/dhl
/media/dhl/*
!/media/dhl/logo.jpg
!/media/downloadable
/media/downloadable/*
!/media/downloadable/.htaccess
!/media/xmlconnect
/media/xmlconnect/*
!/media/xmlconnect/custom
/media/xmlconnect/custom/*
!/media/xmlconnect/custom/ok.gif
!/media/xmlconnect/original
/media/xmlconnect/original/*
!/media/xmlconnect/original/ok.gif
!/media/xmlconnect/system
/media/xmlconnect/system/*
!/media/xmlconnect/system/ok.gif
/var/*
!/var/.htaccess
!/var/package
/var/package/*
!/var/package/*.xml
What these Magento rules actually ignore
Every pattern below, and why it belongs in your .gitignore.
General
| Pattern | What it ignores |
|---|---|
/PATCH_*.sh |
General |
/app/etc/local.xml |
General |
/media/* |
General |
!/media/.htaccess |
General |
!/media/customer |
General |
/media/customer/* |
General |
!/media/customer/.htaccess |
General |
!/media/dhl |
General |
/media/dhl/* |
General |
!/media/dhl/logo.jpg |
General |
!/media/downloadable |
General |
/media/downloadable/* |
General |
!/media/downloadable/.htaccess |
General |
!/media/xmlconnect |
General |
/media/xmlconnect/* |
General |
!/media/xmlconnect/custom |
General |
/media/xmlconnect/custom/* |
General |
!/media/xmlconnect/custom/ok.gif |
General |
!/media/xmlconnect/original |
General |
/media/xmlconnect/original/* |
General |
!/media/xmlconnect/original/ok.gif |
General |
!/media/xmlconnect/system |
General |
/media/xmlconnect/system/* |
General |
!/media/xmlconnect/system/ok.gif |
General |
/var/* |
General |
!/var/.htaccess |
General |
!/var/package |
General |
/var/package/* |
General |
!/var/package/*.xml |
General |
How to use this .gitignore for Magento
- Copy the Magento rules above, or download the file directly.
- Create a file named .gitignore at the root of your Git repository and paste the rules into it.
- If some of those files are already tracked, run git rm -r --cached . then commit again — Git only applies ignore rules to untracked files.
- Commit the .gitignore so everyone on the team shares the same rules.