I’m trying to use Git to manage different versions of a product. There are a few ways I could do this. I’m familiar with the concept of having a “master” branch, and labelling different points along that master branch to constitute named “Versions” of the solution. E.g., at some point in time I might decide that the current build represents the “RP_2012” build of my product. Later on, after some more features have been added, there might be a “RP_2013” version, etc.
It occurs to me that even though development may be finished on a particular ‘version’, bug fixes may still need to be rolled out. E.g., say I’m working in Azure, and each customer has their own version of the solution rather than a multi-tenancy arrangement (because that way I get to be able to offer them newer versions of the product if they want to pay to upgrade, and they get to stay with older versions of the product that they are comfortable with until they are ready to upgrade rather than having new features imposed upon them). I have a script that uses a combination of TeamCity, FluentMigrator, etc, to be able to take the version a particular customer has and upgrade it at will whilst preserving their existing data. So, whilst any new features that are being added to the product will be getting created on their own branch then merged into the Head of master for release in some future version, there also needs to be scope for doing bug fixes that may be applied to any/all of the versions of the product that are currently being used/supported.
If I use the labelled version approach and a single “master” branch as discussed above, rolling out such bug fixes might not be possible. If I instead give each version its own branch, would it be possible to carry out bug fixes in a separate branch that derives from an ancestor of each of the “version” branches, and later merge that one branch into several distinct, version-specific branches? Or is there perhaps some clever way to use Rebase so that if I have a bug fix that will affect versions 10, 11 & 12, say, and those ‘versions’ are just labelled points along the master branch, can I just branch off from the point labelled “version 10” in master, and somehow rebase master to be based on the fixes that will be done in said bug fixing branch, thereby ensuring versions 10 and upwards all benefit from the fixes a given branch addresses? At the same time, of course, any new features would be done by branching off from and merging back into the Head of master.
I hope my question and underlying intent is clear enough. In essence, I would like to know if it’s best to keep different versions of a given product in one master branch. And, if so, how best to implement bug fixes that will be able to be rolled into each version when/if required. This may involve merging a single branch into several discrete descendent branches. Or it may involve rebasing a single branch that all of the versions live in. Or perhaps you guys know of some cleverer way.
Thanks in advance for any suggestions.