views:

98

answers:

2

Hi All, I have 2 project, and actually these 2 project is about 80% same each other, the mainly difference is just about language and business model, one is for larger audience using english language and have a 9$/month business model, another is using local language with freemium business model.

Sometime when I want to add new feature/functionality, I want to add it in both of the project, but also sometime I want to add feature especially just for the local project.

My question is, how do I maintain these 2 project with git ?

  1. Maintain 2 git repository for each project or
  2. Maintain single git repository with 2 mainly branch or
  3. Any other suggestion ?
+6  A: 

create three git projects:

  • one "core" project: it contains the code shared between the other two projects

  • your english project: it has a submodule for the core plus specific code

  • your translated project: it also has a submodule for the core plus specific code

this way you can change your core project, update the submodule references and you'd be good

knittl
Submodules are the way to go for this. Everyone needs to be clear on what is happening, but once they are it's the least work.
Andrew McGregor
+2  A: 

Is it possible for you to handle this via configuration and localisation? That is:

  • One code base
  • Two localisation files containing English- and local-language strings
  • Configuration for each version of the website determining the payment model/enabled features and changing behaviour accordingly

My personal view is that one project = one repository. If your websites are clearly very different then I still think your problem could be handled better by refactoring the common code into modules that can be configured and modified in a sane, controlled way. If you allow each project to have its own git repository then, without hard work, they could easily diverge and contain differences that cannot easily be tracked, introducing subtle bugs or untested functionality.

rjh