In certain scenarios you may wish to exclude everything and only include files that you specify. Git does allow this however it’s a bit tricky and the terminology of the gitignore file doesn’t help matters.
In the root of your git repository you’ll need this .gitignore file
# Ignore everything: * !*/ #ignore php error logs errors.log php_errors.log #ignore the backup 'orig' files produced by kdiff *.orig #ignore thumbnails created by windows Thumbs.db #misc .DS_Store .DS_Store? ehthumbs.db _notes cache dwsync.xml .svn .hg !.gitignore
And then for each directory that you wish to include, you will need to include this .gitignore file
#exclude the global ignore for this file !.gitignore #include everything in this directory !* #except these misc .DS_Store .DS_Store? ehthumbs.db _notes cache dwsync.xml .svn .hg