When we switched to git last year (from Subversion) we took a little time and beefed up our ignore file. While working on another project recently, I realized that most of the example .gitignore files for Cocoa/MacOSX/XCode on the web are really not terribly complete, and the results can be very frustrating when you're just getting started with a new repository.
Here's a better .gitignore example. Let me know if I left anything out. (I saw a few examples from people who exclude the pattern "profile", but as far as I can tell, that's really not a very good idea. I assume they have a specific use case of some kind which eludes my pondering.)
The current version of this file can be found on GitHub:
.gitignore for Xcode, Cocoa, Swift, Objective C, Mac OS X, iOS, TV, Watch
A better .gitignore for XCode, Cocoa, and Mac OS X git repositories:
# Mac OS X Finder and whatnot .DS_Store # Sparkle distribution Private Key (Don't check me in!) dsa_priv.pem # XCode (and ancestors) per-user config (very noisy, and not relevant) *.mode1 *.mode1v3 *.mode2v3 *.perspective *.perspectivev3 *.pbxuser # Generated files VersionX-revision.h # build products build/ *.[oa] # Other source repository archive directories (protects when importing) .hg .svn CVS # automatic backup files *~.nib *.swp *~ *(Autosaved).rtfd/ Backup[ ]of[ ]*.pages/ Backup[ ]of[ ]*.key/ Backup[ ]of[ ]*.numbers/