Pregunta

In Xcode 5 I am developing a universal iOS app - on three different Mac OS machines (on which I happen to have different usernames too - "admin", "alex", etc.)

My project uses the SDWebImage library through CocoaPods and I plan to add few more later.

I would like to keep my project in a Git-repository on GitHub or BitBucket.

I'm confused: which files of my project should I check in into the git repository.

Especially I wonder about 2 groups of files:

  1. The CocoaPods-related (currently I've only checked in the Podfile and Podfile.lock, but there are also Pods.xconfig and Pods, etc.)
  2. And the Xcode-related (should I check in the Workspace Settings? What to do with User Data - admin - ...?)

Here is the screenshot of the commit dialog:

Xcode screenshot

When I run git clean -n -d in my project dir, I see the following:

Would remove Podfile.lock
Would remove Words.xcodeproj/xcuserdata/
Would remove Words.xcworkspace/

And my Podfile contains the following:

platform :ios, '6.0'
pod 'SDWebImage'

UPDATE:

I use a .gitignore containing xcuserdata, but for some reason still see the User Data files in the commit dialog:

xcode screenshot

¿Fue útil?

Solución

This is a bit of a matter of taste and requirements for your projects. There are two schools:

  1. Never check in generated code. Put your xcworkspace, Podfile.lock and Pods folder in .gitignore and never commit them. Instruct developers on your code base to run pod install directly after checkout. This is my preferred choice, and should work fine as long as your pod dependencies point to a specific version or a range of compatible versions.

  2. Check the workspace, lock file and Pods directory into Git with the rest of your code. This is a guarantee that all developers on the project are using the exact same code when they build. Even if your third party dependency removes their code from the Internet, your project is still buildable. However, you now have a lot of source code that is unrelated to your own, version controlled together with your own.

As an aside: you should probably always put "xcuserdata" in your gitignore, maybe even your system-wide git ignore, because other users of your code are probably not interested in your personal Xcode settings.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top