Reputation: 3420
I wonder what the best Git strategy is if you are building different xcode projects off a master project. So they use the same core classes but maybe different assets and perhaps different views? Any major changes are always committed/merged back into the master project.
Do I create new xcode project then check out base classes, including the AppDelegate, create a branch or a clone?
Any other strategies? Part of where I want to head is creating a major part of this master project as a SDK so any ideas heading to that point are appreciated.
Upvotes: 0
Views: 52
Reputation: 38010
You might want to use submodules, which will let you keep your common code in a git repository that can be incorporated into other repositories. The top-level repository won't track the individual files in the submodule, it will think of the entire submodule as one file and only track which commit HEAD
points to in the submodule.
Edit (based on your comments): I suppose you already have a git repo containing both a "regular" project and the common code. I suggest the following steps:
git rm --cached -r commonDirectory
cd commonDirectory
and git init .
.gitignore
from the top-level repo if you have one, and add and commit all non-ignored files in commonDirectory
to the new repo. You now have one git repository living inside another, but it's not a submodule yet.cd
into the top-level repository, run git submodule add commonDirectory
, and commit that (together with the removal of all the files in commonDirectory
).Note that there are some subtleties related to cloning repositories that contain submodules.
Upvotes: 1