xcode xcworkspace 应该在 gitignore 中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22345575/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Should xcworkspace be in gitignore
提问by Radenko Zec
I am using GitHubObjectiveCGitIgnore
我正在使用GitHubObjectiveCGitIgnore
When I go in sourcetree to commit I see :
当我进入 sourcetree 提交时,我看到:
project.xcworkspace
This file is not ignored using Github .gitignore file. I am not sure do I need to commit and push this file?
使用 Github .gitignore 文件不会忽略此文件。我不确定是否需要提交并推送此文件?
回答by JJC
If you're using Cocoapods, I actually find that the answer depends on a few things.
如果您使用 Cocoapods,我实际上发现答案取决于一些事情。
- If you just want the project to be compilable and runable "out of the box", then go ahead and check everything in; xcworkspace and all pods.
- If there is a pod that you need to modify for some reason and you want to include that change with your project, then check everything in. For instance, I've found bugs that haven't been fixed for one reason or another and it was easier to just fix them myself and check in the pod along with my project rather than wait for the updated pod or integrating the library manually (which is essentially the same result as checking the pod in anyways). Alternatively, fork the repo, push your changes to it, and point your pod to your fork.
- If you have no issues with any of the pods and you've verified that everything works with the versions of the pods you've specified, then you don't have to check in the xcworkspace file or pods. Of course, you'll have to run
pod install
in this case.
- 如果您只是希望项目“开箱即用”可编译和运行,那么请继续检查所有内容;xcworkspace 和所有 pod。
- 如果您出于某种原因需要修改某个 pod,并且您希望将该更改包含在您的项目中,那么请检查所有内容。例如,我发现由于某种原因尚未修复的错误更容易自己修复它们并将 pod 与我的项目一起检入,而不是等待更新的 pod 或手动集成库(这与无论如何检查 pod 的结果基本相同)。或者,将 repo 分叉,将您的更改推送到它,然后将您的 pod 指向您的分叉。
- 如果您对任何 pod 都没有问题,并且您已经验证所有内容都适用于您指定的 pod 版本,那么您不必签入 xcworkspace 文件或 pod。当然,你必须
pod install
在这种情况下运行。
There's no hard and fast rule on what to do here. Sometimes it's worth the extra overhead to just check everything in, and sometimes it's not necessary. It depends on what's most convenient for you.
在这里做什么没有硬性规定。有时只需检查所有内容就值得额外的开销,有时则没有必要。这取决于什么对您最方便。
回答by Rich
In short yes it should be commited.
简而言之,是的,它应该被提交。
I have my xcworkspace
file checked in to my repo. If you don't use a workspace it probably isn't needed but as I use Cocoapods this creates a xcworkspace
with the original project and the pods project inside of it.
Use a workspace is the correct way on handling multiple project sets/dependencies.
我已将我的xcworkspace
文件签入到我的回购中。如果您不使用工作区,则可能不需要它,但是当我使用 Cocoapods 时,这会创建一个xcworkspace
包含原始项目和其中的 pods 项目的项目。使用工作区是处理多个项目集/依赖项的正确方法。
回答by BadmintonCat
If you have/or plan to have several projects in the workspace (for example sub projects of your project) then you should not add it to .gitignore
.
如果您有/或计划在工作区中有多个项目(例如项目的子项目),则不应将其添加到.gitignore
.
Cocoa pods just adds its own project to the workspace if a workspace exists when you do a pod install
.
如果在您执行pod install
.
In general it is safer to include the workspace file in the git commit, even if you exclude pods.
通常,在 git commit 中包含工作区文件更安全,即使您排除了 pod。
You will have to do a pod install
anyway to compile your project so even if you commit a workspace file that already has the cocoa pod project added it wont cause any issues.
您pod install
无论如何都必须编译您的项目,因此即使您提交一个已经添加了可可豆荚项目的工作区文件,它也不会导致任何问题。