2

A common approach to the existence of both RC and Hotfix is:

Hotfix should not exists (or can, but very shortly) the same time while there is a pending RC.

Looking at this image :

enter image description here

What if there is a pending RC which is on staging, and wasn't fully tested yet, and suddenly there is a need for an urgent hotfix?

Sure we would then create a hotfix branch, fix it, and merge back to dev and master.

But what about the pending RC ?

  • It doesn't contain the change.
  • Git flow says we should not merge the hotfix to RC.
  • We can't trust the fix is on master, because strictly speaking, RC should be uploaded and tested as a whole.

So should we then cancel the RC ? but then dev would not be the same as it was when RC was branched

Question

Assuming there is a pending non-fully-tested-RC, and an urgent hotfix, what should be done in terms of RC?

Even if we upload the RC (without the hotfix) to master (which contains the hotfix) - only the next RC will contain the hotfix (becuase of the dev merge with hotfix) - but it says that an RC which was never tested with the hotfix - is going to be uploaded !!!

I didn't find such information about those kinds of scenarios.

How should we deal with RC's and hotfixes?

Maroun
  • 94,125
  • 30
  • 188
  • 241
Royi Namir
  • 144,742
  • 138
  • 468
  • 792

2 Answers2

2

That is why you don't use gitflow.

If you have that kind of non-linear development, with out-of-sequence development effort (like an hotfix), you would use 'gitworkflow" (one word, also introduced here): the workflow used by the Git repo itself.

With Gitworkflow, your RC would be in master, and your hotfix in a maint branch which (contrary to Git Flow) can then be merged to master if needed.
(note: not all hotfixes need to be backported/merged to master or dev: sometime, you are hot-fixing in the current production release something which is no longer relevant in the next development cycle).

The other difference with Git Flow: "public" and "next" (aka 'devel') branches are never merged to master. They are "transient" or "ephemeral", always deleted/recreated.
Only feature branches are merged to the lifecycle branches (public, next, master). That means at any time you can chose to drop a feature between one stage of the development lifecycle and the next.
And master can receive a merge from 'maint' (hotfixes) at anytime.

Then dev (called next) and pu (for experimentation) are simply reset/recreated, with their respective selecgted feature branches already merged in them, since Git 2.18 brings git rebase --rebase-merges.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • In atlassian they talk about 4 flows. https://i.imgur.com/4L5b508.jpg . is it one of them ? I want to see the differences so it would be easy for me to learn. – Royi Namir Mar 27 '19 at 06:49
  • @RoyiNamir Can you give me the URL of the Atlassian page? – VonC Mar 27 '19 at 08:13
  • @RoyiNamir No, it is not part of that list. It is closer to gitflow (https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow), but the differences are explained in my answer above. – VonC Mar 27 '19 at 08:17
  • I didn't find even youtube video about it. pretty strange that it's that non-famous. – Royi Namir Mar 27 '19 at 11:10
  • @RoyiNamir gitflow was early, and easier to understand, but less efficient. gitworkflow is superior, and presented in https://github.com/rocketraman/gitworkflow. – VonC Mar 27 '19 at 22:33
2

You say:

Git flow says we should not merge the hotfix to RC.

But reading the Gitflow page I read the exact opposite in "Finishing a hotfix branch":

The one exception to the rule here is that, when a release branch currently exists, the hotfix changes need to be merged into that release branch, instead of develop. Back-merging the bugfix into the release branch will eventually result in the bugfix being merged into develop too, when the release branch is finished. (If work in develop immediately requires this bugfix and cannot wait for the release branch to be finished, you may safely merge the bugfix into develop now already as well.)

So there is no problem :-)

Royi Namir
  • 144,742
  • 138
  • 468
  • 792
A.H.
  • 63,967
  • 15
  • 92
  • 126
  • Interesting ....Is there any official place that it can be found ? or is it just one's suggestion.........becuase if I merge the hotfix to RC , then what about dev ? I will upload RC to master , and then download hotfix to dev ? – Royi Namir Mar 09 '19 at 12:12
  • The link I have posted points to the post "A successful Git branching model" written Vincent Driessen. He is the "inventor" of that model. So I think this post is *the* official place. Your second question: It is explained in the paragraph I have cited: HF is merged to RC which in turn is merged to `develop`. – A.H. Mar 09 '19 at 14:53