Reputation: 153
I am quite new to git but the advantages to use it are quite clear! I have been developing for iOS and I have created some custom class of mine that I share among several projects, I would like to keep them centralized so I can pull and push only from/in a single place, and only that specific folder will be always up to date with the latest changes, that can come from different projects.
How can I setup practically a scenario like this? I really thank you in advance!
Upvotes: 0
Views: 79
Reputation: 119031
You can think about a git repository in one of 2 ways:
If you think of it as a git owned / controlled repository then you might want to add other repositories to it. These are called submodules. It's a way of including one repository's contents into another. Read enter link description here. Doing this means that everything will be under a single folder and if you clone the repository you'll get everything required for the project.
If you think of it as just a folder of stuff that Xcode uses then there is no reason that Xcode needs to refer to only one folder. You can have multiple repositories cloned to different locations on your machine and files from each of them included in your project. In some ways this is simpler than submodules, but it limits you to always having each of the repositories cloned to the same (relative) locations (only really a concern when you're cloning to a different machine).
If you're working alone then the submodules approach may be more in-depth than you care for. If you're working in a team then it can be a boon (with instructions on what to do when updating the submodules doesn't work properly...).
Upvotes: 1