18

With Xcode 7 finally released I was wondering what an appropriate setting for .gitignore was for Xcode projects in the new version, and whether the same settings that were applicable in XCODE 6 still apply.

NOTE This is XCODE 7 Specific. There are various answers for other version of XCODE but I am unaware if 7 adds any new files or types that should be added to the .gitignore.

Jeef
  • 26,861
  • 21
  • 78
  • 156
  • 2
    Look for Github gitignore file https://github.com/github/gitignore/blob/master/Global/Xcode.gitignore – Marco Jul 31 '15 at 17:50
  • 5
    This is an Xcode 7 specific question. That post you reference is for a different version of Xcode. – Jeef Aug 02 '15 at 19:11
  • 1
    crosscode's answer here http://stackoverflow.com/a/27745571/4515489 has useful info about Xcode 6 (much simpler than Xcode 4), but there still may be changes between 6 & 7, so I agree this is not a duplicate. – jk7 Oct 14 '15 at 19:28

1 Answers1

10

Here's the one I tend to use:

.DS_Store
build
*.xcodeproj/*
!*.xcodeproj/project.pbxproj

That will ignore .DS_Store files, the build directory, and everything in .xcodeproj files except the file that actually contains the project's settings. If you have shared schemes, you can also add

!*.xcodeproj/xcshareddata

as show here.

mipadi
  • 398,885
  • 90
  • 523
  • 479
  • 7
    I wouldn't ignore `*.xcodeproj`, rather ignore `xcuserdata`. – Arkku Jul 31 '15 at 18:53
  • @Arkku: `project.pbxproj` and `xcshareddata` (possibly) are really the only files in the a `.xcodeproj` that _need_ to be tracked. – mipadi Feb 22 '16 at 17:44
  • 1
    True at the moment (unless it contains workspaces?), but I would rather blacklist than whitelist here, since a) currently it's simpler that way, and b) the contents of `.xcodeproj` could change without notice as it is a proprietary format… – Arkku Feb 22 '16 at 17:59