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:
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.