5

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.

Arnaud
  • 7,259
  • 10
  • 50
  • 71
MB.
  • 723
  • 1
  • 11
  • 28
  • Why did you split your Xcode workspace into these three Xcode projects. The Xcode tool already has support for building an iPad app and an iPhone app from a shared set of code and resources - as one project. – GoZoner May 19 '12 at 03:42
  • 1
    It's a long story but the apps are not the same and they have no common release info they were not meant to be an iPad version of the app but a separate released product. – MB. May 20 '12 at 01:55

1 Answers1

4

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

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250