Commit to git after switching to workspace and adding CocoaPods in Xcode?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 17:17:11

问题


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.)


回答1:


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:

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:

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.



来源:https://stackoverflow.com/questions/22291456/commit-to-git-after-switching-to-workspace-and-adding-cocoapods-in-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!