Sample .gitignore files for various projects
These go into GIT_DIRECTORY/.gitignore
Also checkout an extensive collection of gitignore repository here : https://github.com/github/gitignore
For Generic project
we ignore backup files (*~) and vim swap file (.swp), MacOS dir file (.DS_Store) and any file with .out extension (a.out ..etc)
.gitignore
## generic files to ignore *~ *.lock *.DS_Store *.swp *.out
For Rails project
We ignore the sqlLite database files. I also don't check in 'database.yml'. I check in as 'database.yml.sample' and let each developer have their own 'database.yml'
.gitignore
#rails specific *.sqlite3 config/database.yml log/* tmp/* ## generic files to ignore *~ *.lock *.DS_Store *.swp *.out
For Java project
Ignore generated class files (*.class) and any project specific files (netbeans / eclipse)
.gitignore
#java specific *.class #netbeans ignore personal stuff nbproject/private/ ## generic files to ignore *~ *.lock *.DS_Store *.swp *.out
For Python project
Ignore compiled files (*.pyc)
.gitignore
#python specific *.pyc ## generic files to ignore *~ *.lock *.DS_Store *.swp *.out
For XCode / iPhone project
thanks to : http://snipplr.com/view.php?codeview&id=8865
Ignore build files (build) and any xcode project specific files (updated for xcode4)
.gitignore
#xcode specific build/* *.pbxuser *.mode2v3 *.mode1v3 *.perspective *.perspectivev3 *~.nib #ignore private workspace stuff added by Xcode4 xcuserdata project.xcworkspace ## generic files to ignore *~ *.lock *.DS_Store *.swp *.outAlso http://shanesbrain.net/2008/7/9/using-xcode-with-git recommends having a .gitattributes so the Xcode project file treated as a binary
.gitattributes
*.pbxproj -crlf -diff -merge
** Comment on this article **