Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure GIT repository in Xcode Workspace with multiple projects

This is more a question of what is the correct strategy than a "how to" for that I already have the GIT manuals.

I have an Xcode workspace. It contains 3 sub projects.

  1. iPad app
  2. iPhone app
  3. shared code and resources (pngs, etc)

I have been thinking of creating GIT repositories but was looking for some advice as to what would be the best strategy for setting these up.

For each of the sub projects, I may well have multiple branches and would need to have some control over which version of the shared code would be used for each branch of the the "app" sub project.

At the present, the way in which I incorporate the shared code is by copying a reference to that file into the "app" project. I'm not sure if this is the best way going forward as I'm not sure what will happen if I need multiple branches of the shared code.

If anyone out there has a similar set up and can advise, I would appreciate it.

like image 214
MB. Avatar asked Oct 07 '22 19:10

MB.


1 Answers

You should declare the shared code as a submodule.

That way, both apps would reference their own commit of your shared code repo.
If you need to do any modification in that shared code repo, you can go in that sub-directory, make them and commit them, but you will need to go back to the parent repo (one of the apps) and commit as well.
See "true nature of submodules".

like image 101
VonC Avatar answered Oct 12 '22 12:10

VonC