What goes into your .gitignore if you’re using CocoaPods?

I commit my Pods directory. I don’t agree that the Pods directory is a build artefact. In fact I’d say it most definitely isn’t. It’s part of your application source: it won’t build without it!

It’s easier to think of CocoaPods as a developer tool rather than a build tool. It doesn’t build your project, it simply clones and installs your dependencies for you. It shouldn’t be necessary to have CocoaPods installed to be able to simply build your project.

By making CocoaPods a dependency of your build, you now need to make sure it’s available everywhere you might need to build your project…a team admin needs it, your CI server needs it. You should, as a rule, always be able to clone your source repository and build without any further effort.

Not committing your Pods directory also creates a massive headache if you frequently switch branches. Now you need to run pod install every time you switch branches to make sure your dependencies are correct. This might be less hassle as your dependencies stabilise but early in a project this is a massive time sink.

So, what do I ignore? Nothing. Podfile, the lock file and the Pods directory all get committed. Trust me, it will save you a lot of hassle. What are the cons? A slightly bigger repo? Not the end of the world.

Leave a Comment