KISS

Keep It Simple Stupid

"Should I store CocoaPods' products in git?"

| comments

TL;DR: yes.

This is the question I was thinking about some time ago, when I bumped into the CocoaPods project. It seems to be trivial, but not that much…

In a nutshell, CocoaPods is a dependency manager for OS X/iOS projects. You specify what third-party libraries and frameworks your project uses, run pod install, and CocoaPods will create/update a Pods directory with the dependencies.

In general, the rule of thumb is you don’t keep generated and/or binary files that can be recreated in a source control management system. The Pods directory can definitely and is supposed to be generated by the aforementioned command, but it requires so many steps (my way):

  1. Install Command Line Tools in Xcode (if not installed yet).

  2. Install homebrew.

  3. Install rbenv, ruby-build, ruby in virtual environment, and all the dependencies.

  4. Install cocoapods with gem.

  5. Finally, run pod install.

Quite a long road, isn’t it? Especially, for a case when you need to quickly build the project on somebody else’s mac with xcode only (that was my situation once). Therefore, in such a case the fact that all the sources are in git comes in handy.

On the other hand, to be honest, my initial thought about not putting the Pods directory into git was supported by the feeling of self-importance. You’ve gone all the way to setup CocoaPods in your system, restructured the project to be dependent on it, and written a doc about how to do the same. It’s great, but isn’t very helpful for a new guy or you in a new environment.

To conclude, I think it’s better to put the CocoaPods’ products in the git repository to simplify your and other developers’ lives.

Comments