I want to implement gitflow but I have a question.
Let's imagine I have release version 1.0.0, it works nicely so I merge it into master.
We deploy and it goes to prod.
Sadly we didn't notice something terrible that brings prod down so we immediately rollback to version 0.9.0 that works fine.
At this point in time we see that a small bug is found in 0.9.0 so we should apply an hotfix...
But at this point also the head of master is on 1.0.0 and, above all, master also contains the merge of broken code.

What is the correct way to handle this scenario using gitflow?

1 Answer 1


It doesn't make much sense that you'd want to fix the "small bug" in 0.9.0 before fixing the issues that prevented 1.0.0 from being deployed to production. It seems like 0.9.0 was in production, people were using it, and the "small bug" wasn't a concern for the users. If it was, I would have expected a 0.9.1 hotfix to take priority over a 1.0.0 release.

Following gitflow, I'd create a hotfix branch using the mainline branch's 1.0.0 tag to fix the key production issues. Depending on the schedules and risks, I'd consider also fixing the "small bug" found in 0.9.0 if it still exists in the 1.0.0 branch. Then, I'd merge the hotfix branch into the develop branch and the mainline branch, tagging it as 1.0.1 and deploying to production.

If necessary, you could also split up the two fixes. You could create a hotfix branch from 1.0.0 to fix the issues that led to the rollback in production, tagging this as 1.0.1 in the mainline branch. You can then fix the "small bug" from 0.9.0 in another hotfix from 1.0.1, and deploy that as 1.0.2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.