问题
Let's say I have a simple mobile game, Fruit Wars*. Players shoot oranges, apples, bananas, pineapples, etc at each other, collect points, level up, etc etc. It's doing well, and I'd now like to make similar titles - Vegetable Wars, Sushi Wars, Gluten-Free Vegan Kosher Wars, etc, all based on the same codebase of the classic Fruit Wars. What's the best strategy, using Git, for managing the codebase of these clones, keeping the following in mind:
(1) The majority of the features will be the same between clones, except for graphics, UI text, and maybe some minor feature additions/changes that possibly change the gameplay in minor ways.
(2) Additions to the "core" codebase, like bug fixes, should only be done once and easily merged into clones.
(3) Clone-specific functionality should not be allowed (or should be very difficult) to be pushed upstream into the "core" game codebase. For example, if I add a make your own roll minigame to Sushi Wars, the Vegetable Wars codebase should remain unaffected.
My instinct is to go with Git subtrees. What are the other options out there I should consider?
*I am not actually associated with any game that might exist called Fruit Wars
回答1:
The other option is to declare a "core
" git repo within each of your other project git repo as a submodule.
Since a submodule can be set to follow a branch, once you have done a modification in core
, all you need to do in another project using core
is:
git submodule update --remote.
Since the roll
minigame to Sushi Wars
would be added in Sushi Wars
tree (but not in Sushi_Wars/core
), the core
repo would never be aware of that new feature.
来源:https://stackoverflow.com/questions/22264179/best-approach-for-handling-cloned-applications