mikew
mikew

Reputation: 1744

Forking a new version of my application

I am looking for some ideas as to how to branch my application so as to have a feature limited version of it.

Let me give a hypothetical. Lets say my desktop app interacts with all web browsers. I get into a partnership with the guys at Google Chrome who want to release a version of my app that works ONLY with their browser, and will exclude IE, Firefox, etc.

How would I go about doing this? I could create a separate branch in git, and then run my build script twice, while switching branches in between. I could also just copy the full code directory, and build from each dir.

A problem I forsee, is that I want bugfixes in my full program to automatically be updated in limited version as well. There are probably other problems that I don't realize yet as well. So I'm looking for guidance.

Thanks

Upvotes: 0

Views: 114

Answers (4)

Nev Stokes
Nev Stokes

Reputation: 9779

If you fix something in your full program then you'll obviously run your build script to check for regression bugs right? So maybe a targeted build script could be an option. I'd say that or look into adapting the use of flags (the guys at Asana are big fans).

Upvotes: 1

Stein G. Strindhaug
Stein G. Strindhaug

Reputation: 5119

Usually if a feature branch differs from the parent branch mainly by removing some sections of code, pulling from the parent branch will update all the common code as expected. If the deleted sections is changed you will most likely get a conflict but it's fairly easy to resolve.

On the other hand, in this scenario, I'd say adding a configuration that disables some features during build would be a simpler solution. (How you do this will depend on the language and build tool you use.) You could still have this limited version on a separate branch, and adding

if(someConfigVariable){
    includeSomeCode() 
}

in the code, instead of deleting the code you don't need, will most likely make the merges easier.

Upvotes: 0

damianb
damianb

Reputation: 1224

A problem I forsee, is that I want bugfixes in my full program to automatically be updated in limited version as well. There are probably other problems that I don't realize yet as well. So I'm looking for guidance.

You can cherry-pick commits in between branches, assuming that they don't conflict with the current working tree. If you make the fix commits as exact as possible for one branch, you should be able to cherry pick them onto the other just fine -- you might need to customize the fix though according to the current code, but that would happen regardless.

Upvotes: 0

SamT
SamT

Reputation: 10610

Depending on the kind of app, you want to leave it as multi-platform as possible. If you create two separate sources, you really have two separate programs - it is better practice to have two separate repositories (where one might be forked off the other).

Branches have their place for tangent sub-projects, such as "feature-kitchensink" or to distingush between a develop version ("develop-1.1") and master ("master"). The idea is that you want the sources in each branch to be similar enough to be merged later.

Branches and repos are cheap in git, don't be afraid to use what you need.

Upvotes: 0

Related Questions