Sample Git Ignore File For Magento

back to tech articles
Magento 1.7, Git 1.7

This subject is open to vicious debate. In my own opinion, every Magento site’s .gitignore file will (and probably should) be different.

I’m working on a project where content is added on the production environment and needs to be available on the local and staging environments as well. This content is usually in the form of Magento modules and extensions, but may also include design changes in the theme files.

The idea is that you can pick out what may be useful from the following example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.project
*.sublime-project
*.sublime-workspace
*.tmproj
*.bak
*.swp
*~.nib
/errors/
/install.php
/lib/Zend/
/lib/Varien/
/LICENSE*
/media/
/php.ini.sample
/pkginfo/
/RELEASE_NOTES.txt
/var/

The Zend core is ignored because it contains the Zend Framework – files which we should never be editing. I have included the Mage core files as a reference point in the repo. Again, we should never be editing those files. Changes to Mage core should always extend the core, not override it.

Because several users use Sublime Text, and others Text Mate IDE, we exclude their project files. Otherwise, the majority of the beast is there. Hopefully that helps someone.

For reference, here is another, extensive example from Branko over at Inchoo.