Last Updated: February 25, 2016
· ayberkt

Use git properly with XCode Projects

This goes into your .gitignore

# OS X Finder 


# Xcode per-user config 
*.mode1 *.mode1v3 *.mode2v3 *.perspective *.perspectivev3 *.pbxuser *.xcworkspace xcuserdata

# Build products 
build/ *.o *.LinkFileList *.hmap

# Automatic backup files 
*~.nib/ *.swp *~ *.dat *.dep

The following is from the book Pro Git by Scott Chacon. Quoting him:

Some files look like text files but for all intents and purposes are to be treated as binary data. For instance, Xcode projects on the Mac contain a file that ends in .pbxproj, which is basically a JSON (plain text javascript data format) dataset written out to disk by the IDE that records your build settings and so on. Although it’s technically a text file, because it’s all ASCII, you don’t want to treat it as such because it’s really a lightweight database — you can’t merge the contents if two people changed it, and diffs generally aren’t helpful. The file is meant to be consumed by a machine. In essence, you want to treat it like a binary file.

So this goes into your .gitattributes

*.pbxproj -crlf -diff -merge