emalamisura
emalamisura

Reputation: 2904

Best way to organize source control for Mobile Platforms?

I am trying to decide the best way to organize my projects in source control. They share the same code but they do not and cannot share the same binary assemblies. In addition, even though the code itself is nearly 98% identical there are various minor differences due to each platform. The current project is built for 4 platforms.

I use Git as my source control, I tried using multiple branches but it became a nuisance when I worked on branch 1, and wanted to take those changes over to branch 2, since the code is close but not identical I couldn't do a merge, I need to manually copy the code over and tweak it.

So my current solution is separate repositories for each platform. Any thoughts on how this can be improved?

Upvotes: 1

Views: 195

Answers (2)

Wyzard
Wyzard

Reputation: 34571

The usual way to maintain a multi-platform application is to have one codebase that can be built for any supported platform, using things like #if to enable and disable platform-specific portions as appropriate. You definitely don't want to maintain them as separate branches and have to copy every change to all of them.

Upvotes: 1

VonC
VonC

Reputation: 1328152

If the differences are really small in term of number of files, it would be best to:

  • keep only one repo (no need for submodules for one large common code base, and small number of platform-specific files)
  • keep branches to isolate development efforts (like preparing the next release, or trying some new feature), but not for platform-specific changes
  • try organizing your code in such a way it:
    • can generate the right delivery for a given platform
    • doesn't need to isolate each platform-specific developments in a branch, but rather through directories (one for each platform, with the files including code tailored for each platform)

Upvotes: 0

Related Questions