Should we commit pod files to version control system (GIT or SVN)

£可爱£侵袭症+ 提交于 2019-12-03 07:48:15

问题


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.

Then our Lead changed and he said to commit the pod file to Git. So I was confused which one to go with.

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.


回答1:


Whether or not you check in your Pods folder is up to you, as workflows vary from project to project. It is recommended that you keep the Pods directory under source control.

Benefits of checking in the Pods directory

  1. 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.
  2. The Pod artifacts (code/libraries) are always available, even if the source of a Pod (e.g. GitHub) were to go down.
  3. The Pod artifacts are guaranteed to be identical to those in the original installation after cloning the repo.

Benefits of ignoring the Pods directory

  1. The source control repo will be smaller and take up less space.
  2. 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.)

3.There won't be any conflicts to deal with when performing source control operations, such as merging branches with different Pod versions.

Source: Cocoapods




回答2:


I suggest & recommend, not to commit pods directory(third party source integrated using Pod) in your Git/SVN repository.

Here is sample source, suggesting you, what to commit and not.

  1. 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.
  2. You can easily integrate all Pod libraries/files source using command pod install from any source/destination.
  3. 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.

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



来源:https://stackoverflow.com/questions/45587084/should-we-commit-pod-files-to-version-control-system-git-or-svn

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