简体   繁体   中英

Maintaining Project with Git

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 ?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM