Xcode projects and .gitignore

Xcode projects produce quite a few additional settings files that you may or may not want to commit to your Git repository. Some of these may be useful to share with your team members, and some not. A shared (committed to the repository) .gitignore file is therefore very useful. However, not everyone agrees on what should be included in this file.

My .gitignore file for any Xcode project consists of this:

project.xcworkspace/
xcuserdata/

This ensures that individual user settings like breakpoints, Xcode UI layout and workspaces don’t get committed as each team member (or, in my case, each instance on different Macs) will obviously want their own, local, settings.

(“.DS_Store” and other spew is listed in the “.git/info/exclude” file for each of my local repositories. This means that each team member can add their own ignored files without adding them to the shared .gitignore file. Read this for more information.)

Schemes are localized because they include the user name, like this:

MyProject.xcodeproj/xcuserdata/user_name.xcuserdatad/xcschemes/MyScheme.xcscheme

So, they probably should be ignored.

However, shared schemes are saved like this:

MyProject.xcodeproj/xcshareddata/xcschemes/MyScheme.xcscheme

So, don’t ignore the “xcshareddata/” pattern.

Begin typing your search term above and press enter to search. Press ESC to cancel.