Third Party Code and Git

When developing iOS applications, I often use third-party code from GitHub and the reuse classes that I created myself. What I did was clone the source code into a specific folder somewhere in ~/Documents , where I saved all the library code. Then I dragged the source files into the project and Xcode, and the local Git repository tracked the changes in my source code. So far, so good, but I recently found a serious problem: I wanted to go back to the old version of my Xcode project and found that it no longer compiles, because it used an older version of third-party code, and nowhere was it I saved which version it used!

How is this problem usually resolved? I looked briefly at the w20> submodules, but I'm not sure if this is correct. I also read briefly about CocoaPods, but can I use this for libraries that I created myself?

+6
source share
1 answer

It is actually solved using the git submodule : the idea is to reference the exact commit for each submodule that you need, go back in history and find the consistent set of commits that you need to compile your project.
(More in this answer )

However, this requires a small change in your working tree structure, as each submodule becomes subdirectories of the parent repo that your project represents.

Note also that it (the git submodule) is useful for source dependencies.
CocoaPods will be more for creating the binaries you depend on (binary dependency).

+7
source

All Articles