Git - Independent Branches or Different repos for instances of the same program with slightly different use

StackOverflow https://stackoverflow.com/questions/10342287

문제

I recently started using git and have a question. I have two branches of a program, one which uses algorithm A and one which uses algorithm B. These algorithms do the same thing differently. Now, for each of these two branches I want to make different instances of the program which run for different sort of data (these can be up to 50 different instances). Before you ask, I can't incorporate them all in the same program because of complexity and performance issues.

Additionally, if possible, I would like to be able to modify the core (i.e. the part of the source that is shared between all instances) and all instances to be updated with the change.

What method would you recommend to achieve that?

PS: Since my question may not be very clear, feel free to ask for any additional information.

도움이 되었습니까?

해결책

If they do the same thing differently, try to make them conform to a common interface/API. If you can do that, then apply the Bridge pattern The two implementations can just live in different subdirectories. You don't really need git or branches do manage this--just have two different implementations of behind the Bridge and choose the correct impl at runtime (or compile-time, as it seems you prefer the compile-time approach).

다른 팁

You can have a master branch with the core code and 2 other branches with alg and alg B so you merge master to your algorithm branches. That way you can have two different programs that have a different algorithm but the same core. I dont really understand what you mean by instances

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top