Which files should I include in .gitignore
when using Git in conjunction with Xcode?
Mine is a .bzrignore, but it is the same idea :)
.DS_Store
*.mode1v3
*.pbxuser
*.perspectivev3
*.tm_build_errors
The tm_build_errors is for when I use TextMate to build my project. It is not quite as comprehensive as Hagelin, but I thought it was worth posting for the tm_build_errors line.
Best of all,
gitignore.io
Go and choose your language, and then it'll give you the file.
We did find that even if you add the .gitignore and the .gitattribte the *.pbxproj file can get corrupted. So we have a simple plan.
Every person that codes in office simply discards the changes made to this file. In the commit we simple mention the files that are added into the source. And then push to the server. Our integration manager than pulls and sees the commit details and adds the files into the resources.
Once he updates the remote everyone will always have a working copy. In case something is missing then we inform him to add it in and then pull once again.
This has worked out for us without any issues.
I recommend using joe to generate a .gitignore
file.
For an iOS project run the following command:
$ joe g osx,xcode > .gitignore
It will generate this .gitignore
:
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
build/
DerivedData
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
*.xcuserstate
Based on this guide for Mercurial my .gitignore includes:
.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
I've also chosen to include:
*.mode1v3
*.mode2v3
which, according to this Apple mailing list post, are "user-specific project settings".
And for Xcode 4:
xcuserdata
Heres a script I made to auto create your .gitignore and .gitattributes files using Xcode... I hacked it together with a few other people's stuff. Have fun!
Xcode-Git-User-Script
No warranties... I suck at most of this - so use at your own peril