Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7067349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:11:29+00:00 2026-05-28T05:11:29+00:00

Suppose I have a project implemented in a specific programming language whose use is

  • 0

Suppose I have a project implemented in a specific programming language whose use is fragmented into two (or more) versions, for any reason.

These two versions provide different mechanisms to implement some functionality of the project. Thus, the same code is not portable between versions.

How to organize this situation in a git repository? Nevertheless, Keep directories for specific versions within a branch? Duplicates branchs in the same repository? Or use different repositories for each version?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:11:30+00:00Added an answer on May 28, 2026 at 5:11 am

    It depends a bit on the programming language, but if the difference between the two versions results in a significant difference in your code, then I would want to:

    1. define an interface representing the functionality whose implementation needs to differ.
    2. write two implementations of that interface.
    3. select the right one either at build time or run time, as appropriate to the language and the project.

    Once you’ve separated the two different implementations, you can keep them in the same branch just as you’d keep any two different implementations of the same interface in a branch.

    For a trivial difference, for instance if all you need is to pass slightly different flags to some function, then I’d probably not go to all that trouble. Instead I’d just do the equivalent of:

    #if NEW_PLATFORM
        // enable useful new flag 2
        #define FLAGS 0x11
    #elif OLD_PLATFORM
        // we can live without flag 2 if it's not supported
        #define FLAGS 0x1
    #else
        #error what platform even is this?
    #endif
    

    But beware, insignificant differences can grow as the code develops, and you end up with a mess of platform detection code. You should aim to test the platform in at most one place, or even better just control the whole thing with a build option. In the above case you could call that USE_USEFUL_NEW_FLAG rather than explicitly coding that it depends on a particular platform version. Then it’s up to your build configuration to know which platforms support which features.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a college programming project in C++ divided into two parts. I beggining
Suppose my solution have two project: myApp: silverlight application project: the default application App
Suppose I have two branches of a project IMClient-MacOS and IMClient-Windows, and their code
Suppose you have two seperate ASP.NET Web Application projects that both need to use
Suppose I have a VC++ project containing number of Source (.cpp) files (e.g. 5),
Suppose I have the following (desired) folder structure: *CommonProject *Project#1 ----> CommonProject(link) *Project#2 ---->
Suppose I have the following directory layout in a Maven project: src/ |-- main
Suppose I have a war and jar projects defined in maven. The Jar project
Suppose, I have an opensource project that depends on some library, that must be
Suppose you're working on an enterprise project in which you have to get management

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.