iOS Xcode Source Control creates separate repos for App project and Pods project

patent10021

macrumors 68030
Original poster
Apr 23, 2004
2,961
407
I usually use the command line so I've never seen this in the Xcode UI before. This time when I used Xcode to create a repo for my project, Xcode created separate repo masters for the App Project and Pods Project. Of course the App Project contains the Podfile/Podfile.lock which gets pushed anyway to my repo and I never have a reason to push the Pods Project separately, but I'm wondering why Xcode does this locally? I mean if I did want to push the Pods Project to GitHub it would be pushing that project to a separate repo link. So what would be the point? The App Project and Pods Project reside together in the Xcode workspace so why would they have separate repo links?
 

Attachments

Last edited:

dantastic

macrumors 6502a
Jan 21, 2011
567
645
First of all I would always create the repo before doing the pod init so have probably never come across it but more to the point, you probably don't want your pods in git anyway. Commonly you would just keep your podspec file versioned. You can argue about the lock file but the pods themselves should probably be left off.

I have a global gitignore for Pods/
 

patent10021

macrumors 68030
Original poster
Apr 23, 2004
2,961
407
New Q.

I have a ~/.config folder, but I'm just using my ~/.gitignore_global file since I'm not on a team. Should I create a git/ignore directory in the ~/.config folder then move my ~/.gitignore_global file into the ~/.config/git/ignore folder or just keep it in ~home? Also do you ignore Podfile and Podfile.lock? I noticed they are never included in gitignore templates.
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
Podfile should never be ignored. That file tells pod update what to do. There's less agreement on the lockfile but I always include it. It tells pod install what to do. It's possible to have two branches with different pods installed. You run pod install when switching branches. If you use any kind of build server you want it to run pod install, which requires the lockfile, not run pod update.

You most likely don't want your Pods folder in source control. Just Podfile, Podfile.lock.

There is a small possibility of a Pod being removed from GitHub by its owner and then leaving you in the lurch but I don't think I've heard of that happening. You could fork any pods that you use just in case.
 

dantastic

macrumors 6502a
Jan 21, 2011
567
645
My file sits at ~/.gitignore_global
And yes, keep the podfile in git. Sorry, I said podspec above, that's used for pod distribution. Nevermind that.
I keep the lock file in git as well. Just make a habit of updating your pods regularly though.

I just wanted to add one more thing, try not to rely on too many 3rd party libraries. Pods being removed from github without explanation is rare I think. Don't think I've seen it ever happen. What's more common though is that the author loses interest and stops updating. It's also happened a couple of times I had to spend the night ripping out a 3rd party library for legal reasons. This is a bit of a rant and I'm not saying to avoid pods completely, just be very picky. If the pod isn't awesome just leave.
 
  • Like
Reactions: Mascots