Skip to main content

A better sample gitignore file for XCode Cocoa projects on Mac OS X (iPhone, too)

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/

Comments

  1. hey I borrowed your better code - and I added to it - heres a script that puts this and something for .gitattributes into an Xcode script menu item - to auto generate it for the directory of your choosing.

    http://github.com/tbarbe/Xcode-Git-User-Script

    Thanks for posting your stuff - hopefully my mod is useful to someone.

    ReplyDelete
  2. We've created a GitHub repository and added the (much expanded) .gitignore file that we currently use. Share and enjoy!

    A Better .gitignore for Cocoa and Xcode

    ReplyDelete

Post a Comment

Popular posts from this blog

Data Recovery from bad RAID 1 mirrored volume on Mac OS X

If you're reading this page, it's because you are trying to find good advice on how to recover data from a bad mirrored drive, also known as RAID 1 (one) on Mac OS X or Mac OS X Server 10.4 (Tiger) or 10.5 (Leopard).First, as it says on the cover of the good book, don't panic. Take a deep breath, and take your time.It's very likely that you can recover your data [NOTES 1, 2] in this situation (a probable bad disk in a RAID 1 mirror). The path to doing so is unfortunately not as obvious as it might seem, and not as obvious as it perhaps should be, but it's pretty simple.Read a whole lot about the subject before you try anything, understand what each tool does before you use it, and then read and think some more before you take the first step.Before You BeginNow, a bit of background. Typically in such a situation (a bad drive in a RAID 1 mirror) one would expect to be able to "break" the RAID 1 mirror, using the software controls you used to establish the m…

Raven Zachary: FAIL

Raven Zachary, holding his iPhone upside-down, in the banner at his web site... where he markets his iPhone expertise.FAIL.Raven Zachary, holding iPhone upside-down