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

后端 未结 3 669
野的像风
野的像风 2021-01-31 15:36

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 p

相关标签:
3条回答
  • 2021-01-31 16:12

    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

    0 讨论(0)
  • 2021-01-31 16:12

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


    Update: .xconfig files are not required to commit. PodFile is enough and required to commit.

    0 讨论(0)
  • 2021-01-31 16:17

    If you are using local development pods, there is an annoying issue if you don't commit the Pods repo.

    Assume you are working on a branch and added file X to a local development Pod. So it's added in 'Compile Sources' in the development Pod target of Pods.xcodeproj file.

    Now you switch branch to another commit which doesn't have file X. Since you gitignore the Pods.xcodeproj, the file X remains in 'Compile Sources' and causes build to fail.

    0 讨论(0)
提交回复
热议问题