What to put in your gitignore

A question that comes up frequently is what to put in your .gitignore files.  I recently stumbled across a nice GitHub project which has .gitignore templates for every language it seems.

Here’s a few which are useful in my daily workflow:

iOS and Mac projects in Objective-C, using Xcode – This seems to cover both Xcode 3 and 4.

Android projects in Java and Eclipse

OS X (mainly for .DS_Store)

There’s also a nice explanation of how (project-specific) .gitignore and global .gitignore files work.

By the way, if you accidentally checked in a bunch of files you didn’t want to, use “git rm” to remove them from the repository.