22

I've just added CocoaPods to my current project in Xcode 5. Of course, CocoaPods created a workspace and I've launched the workspace in Xcode. I see both my project and the Pods project in the workspace.

My project has been under source control (local git + remote Bitbucket repository) since day one. Now I want to commit and add the Pod stuff but I think that my repo is too deep in the workspace--when I try to commit (and I've tried various commits to get the Pod stuff to take) it always errors out.

How can I add my Pods to my repo? Do I have to delete the old repo and create a new one (git init) at the Workspace level? (I sure hope not because I'm not that great with git and I have a lot of historical commits in my repo already.)

SwiftArchitect
  • 47,376
  • 28
  • 140
  • 179
Kent
  • 1,705
  • 3
  • 16
  • 26
  • possible duplicate of [What goes into your .gitignore if you're using CocoaPods?](http://stackoverflow.com/questions/9446644/what-goes-into-your-gitignore-if-youre-using-cocoapods) – Mike D Mar 10 '14 at 03:22
  • I read the article and have decided to commit everything. Switching my commit window to the flat list I was able to commit all the files in sections. That's a great other question/answer though...well worth the read. Thanks Mike D. – Kent Mar 10 '14 at 03:33
  • Not directly related to your question, I integrated Cocoapods last week myself and came across problems with the project file: http://guides.cocoapods.org//using/faq.html#%E2%80%9Ccocoapods-has-just-changed-my-entire-pbxproj,-what-gives?%E2%80%9D – Mike D Mar 10 '14 at 03:48

1 Answers1

14

git add .

From the directory enclosing your Xcode project, simply execute a git add .. Documentation here.

Explanation

You likely had the following hierarchy prior pod init:

enter image description here

In all likelihood, your git setup starts at the directory enclosing .xcodeproj.

After pod install, the hierarchy did not change. You merely have more files at the same level:

enter image description here

The .xcworkspace is next to .xcodeproj, not above. You are free to execute

git add .

...followed by

git commit -m "message"

...assuming that .gitignore is set up properly, and wether or not you prefer to commit the Pods directory.

Community
  • 1
  • 1
SwiftArchitect
  • 47,376
  • 28
  • 140
  • 179