Git Ignore All Files Except PHP etc + Solution
Jul 2, 2009 · 1 minute readCategory: git
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
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