而對於 CocoaPods 在 .gitignore 檔案中的設定,


  • The  Podfile must always be under source control.
  • The  Podfile.lock must always be under source control.
  • The Workspace generated by CocoaPods should be kept under source control.
  • Any Pod referenced with the  :path option should be kept under source control.
  • The  ./Pods folder can be kept under source control.

有遇到一個 CocoaPods 使用上的問題,
我們使用的一個第三方 Library 中的檔案有被稍做更動以符合目前專案所需,
卻也因為這個更動讓每次新加入專案的同仁都需要手動去更改 Pods 中的某個套件,
此外每當 pull 一個 commits 下來時都需要再下 pod install 來確保 pods 中各項版本一致(這個問題有部分原因是出在我和同事的 cocoapods 版本不一致所造成),
Luke Redpath這位老兄強而有力的論點獲得了近百個正面投票:

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


又或是Including your Pods directory in source control這篇,
他們的開發團隊商量了一個多月後終於決定要把 Pods 資料夾加入版本控管中,

  • 在切換 branch 或是查看舊的 commits 時不用再下 pod install
  • 掌握 Pods 資料夾內檔案的更動,不會因第三方軟體更新到毀滅版本而不知所措
  • 擁抱所有的開發者,包括那些不愛使用CocoaPods的人


  • 從git上pull包含Pods的內容檔案會比較巨大

從結果來看是 Z > B,