Git Ignore All Files Except PHP etc + Solution

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

Using Git for version control is great, but if like my you work on a lot of different projects then everything you can do to save time setting Git up is well worth it.

One of the features of Git is the ability to only track certain files and ignore other files. For me that means I only want to track files I am likely to be editing and ignore images, flash files and whatever other junk is floating around in a project.

The solution (and all credit and thanks to the kind people on #Git on Freenode IRC) is this .gitignore file. This file will ignore everything except files with the extensions that you set. Dead easy.


#ignore everything apart from php, css, xml, htaccess, sql, js
*
!*/
!*.php
!*.css
!*.xml
!*.htaccess
!*.sql
!*.js



Tags: gitversion controlignore