我们是否应该将 pod 文件提交到版本控制系统(GIT 或 SVN)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45587084/
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 we commit pod files to version control system (GIT or SVN)
提问by Sumeet Purohit
So far I was working on an app and my Team Lead said not to commit the pod files and I just followed his instructions.
到目前为止,我正在开发一个应用程序,我的团队负责人说不要提交 pod 文件,我只是按照他的指示去做。
Then our Lead changed and he said to commit the pod file to Git. So I was confused which one to go with.
然后我们的 Lead 发生了变化,他说要将 pod 文件提交到 Git。所以我很困惑应该选择哪一个。
Should we commit the pod file or not and if we should not then why. Please help me clear on this thing as I went through some articles as well but didn't find any satisfactory answer.
我们是否应该提交 pod 文件,如果我们不应该提交,那么为什么。请帮我弄清楚这件事,因为我也浏览了一些文章,但没有找到任何令人满意的答案。
回答by Imad Ali
Whether or not you check in your Pods folder is up to you, as workflows vary from project to project. It is recommendedthat you keep the Pods directory under source control.
Benefits of checking in the Pods directory
是否签入 Pods 文件夹取决于您,因为工作流程因项目而异。它建议您保留荚目录源的控制之下。
签入 Pods 目录的好处
- After cloning the repo, the project can immediately build and run, even without having CocoaPods installed on the machine. There is no need to run pod install, and no Internet connection is necessary.
- The Pod artifacts (code/libraries) are always available, even if the source of a Pod (e.g. GitHub) were to go down.
- The Pod artifacts are guaranteed to be identical to those in the original installation after cloning the repo.
- 克隆 repo 后,项目可以立即构建和运行,即使机器上没有安装 CocoaPods。不需要运行 pod install,也不需要 Internet 连接。
- Pod 工件(代码/库)始终可用,即使 Pod 的源(例如 GitHub)已关闭。
- 在克隆 repo 后,Pod 工件保证与原始安装中的工件相同。
Benefits of ignoring the Pods directory
忽略 Pods 目录的好处
- The source control repo will be smaller and take up less space.
- As long as the sources (e.g. GitHub) for all Pods are available, CocoaPods is generally able to recreate the same installation. (Technically there is no guarantee that running pod install will fetch and recreate identical artifacts when not using a commit SHA in the Podfile. This is especially true when using zip files in the Podfile.)
- There won't be any conflicts to deal with when performing source control operations, such as merging branches with different Pod versions.
- 源代码控制存储库将更小,占用的空间更少。
- 只要所有 Pod 的源(例如 GitHub)都可用,CocoaPods 通常能够重新创建相同的安装。(从技术上讲,当不在 Podfile 中使用提交 SHA 时,无法保证运行 pod install 会获取并重新创建相同的工件。在 Podfile 中使用 zip 文件时尤其如此。)
- 执行源控制操作时不会有任何冲突需要处理,例如合并不同 Pod 版本的分支。
Source: Cocoapods
来源:可可豆
回答by Krunal
I suggest & recommend, not to commit pods directory(third party source integrated using Pod) in your Git/SVN repository.
我建议并推荐,不要在您的 Git/SVN 存储库中提交 pods 目录(使用 Pod 集成的第三方源)。
Here is sample source, suggesting you, what to commit and not.
这是示例源,建议您提交什么,不提交什么。
- Pod is a dependency manager and may have so many third party libraries in it. You project source will become heavier (large in size) and the same will get it downloaded every time a new destination uses it.
- You can easily integrate all Pod libraries/files source using command
pod install
from any source/destination. - There may be different version of SDK, command line tool and cocoa pod in different systems. It automatically handles integration specific libraries supported by SDK tool & command line version, as well as cocoa pod version.
- Pod 是一个依赖管理器,里面可能有很多第三方库。您的项目源将变得更重(尺寸很大),并且每次新目标使用它时都会下载它。
- 您可以使用
pod install
来自任何源/目标的命令轻松集成所有 Pod 库/文件源。 - 不同系统可能有不同版本的SDK、命令行工具和cocoa pod。它会自动处理 SDK 工具和命令行版本以及可可 pod 版本支持的集成特定库。
Note:It is not bad, you commit pod files with source code to Git/SVN. But also, that's not good to add dependencies (of third party library) with your code, which is not required and easy to handle using pod
on different destinations (systems).
注意:这还不错,您将带有源代码的 pod 文件提交到 Git/SVN。但是,在您的代码中添加依赖项(第三方库的)也不好,这不是必需的,并且pod
在不同的目标(系统)上使用起来很容易处理。