Robert
Robert

Reputation: 677

How do you release a bugfix to a previous version and tag it?

We are trying to adopt gitflow into our process at work. Gitflow is pretty simple when it comes to hotfixes. However, I'm unclear on how I would fix a bug on a previous version of our system.

For example, let's just say we're on version 8.1.3 and I need to make a bugfix to 7.1.5. I could create a branch based on the 7.1.5 tag, but then how do I get that back into master and tag it? Is that even possible using Git? I was thinking of just keeping the release branches and commit and tag there, but I'm not sure if that is the proper way to do things.

Upvotes: 18

Views: 7516

Answers (2)

nwinkler
nwinkler

Reputation: 54507

Git-flow in its original model does not talk about supported major versions at the same time. It does not describe a model where you have the following versions in production:

  • 7.1.5: Two customers are using this
  • 8.2.3: Three customers are using this
  • 9.0.0: This is the next major version that you're currently working on.

In Git-flow, the master branch is your currently supported, released version, everything else is old and considered legacy.

Having said that, and since we're in the same situation, where we have to support multiple major versions at the same time (at least one where we provide bug fixes, and one where we provide new features), we have come up with the following:

  • develop and master: These are the branches for the current work. Anything that goes into the next major version is done here.
  • Once we do a new stable release (e.g. 7.3.0), we create the following branches:
    • 7.3/develop
    • 7.3/master

These branches now become the develop and master branch for this supported release. Any fixes we need to do on v7.3.0 are done in the 7.3/develop branch, and once we create release v7.3.1, it's done on 7.3/develop and 7.3/master.

Changes that need to be done in both develop branches are usually cherry-picked, since we don't want to merge the new features from develop into an older, but still maintained develop branch.

This process takes a bit of setup, but it works quite well, and as long as you remember to create the required branches when you start working on the next stable version, it's not too much overhead.

Upvotes: 15

Chris Maes
Chris Maes

Reputation: 37832

one way could be:

  • create a branch "7.1" on which you create bugfixes (7.1.6, ...)
  • cherry-pick your modifications to put them on top of master as well (where you would tag again, but with another tag: 8.1.4)

not sure this is the best way, but a possibility.

Upvotes: 2

Related Questions