Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a gitflow process for branching and bug fixes with a release branch?

In order to have make sure all code eventually goes through pull request code review, we've started creating branches for features and bug branches off of develop following the git-flow style.

The only problem is that once a bug is found in a release branch, we often have to make a branch off of the release branch in order to do a pull request back to the release branch. But there doesn't seem to be an obvious git-flow process for handling branches off of the release branch when bug fixing a release branch.

What is the git-flow process for fixing release branch bugs and code review?

Are you supposed to fix the bug in develop and create a new release branch? Is branching off of a release branch still valid git-flow? What's the best way to handle pull request code reviews on release branch bug fixes?

like image 373
Mark Rogers Avatar asked May 09 '17 03:05

Mark Rogers


People also ask

What is Gitflow branching?

Updated on: 6/17/2022. Git flow is a popular Git branching strategy aimed at simplifying release management, and was introduced by software developer Vincent Driessen in 2010. Fundamentally, Git flow involves isolating your work into different types of Git branches.

What is the point of a release branch?

The release branch helps isolate the development of an upcoming version and the current release. The release branch's lifetime ends when a particular version of a project is released. Once this branch merges into the develop and main branches, it can be deleted.

What are the three types of branching in git?

The two primary branches in Git flow are main and develop. There are three types of supporting branches with different intended purposes: feature, release, and hotfix.


2 Answers

I just came accross this same issue. I suggest creating a normal branch from the release branch. Make your fixes there and create a pull request for that branch to be merged to the release branch. This is using the normal branch and merge commands and not the Git Flow commands.

Step details below:

  1. checkout the release/2017.05.24 branch. Where 2017.05.24 is the name of the release branch.
  2. Execute the branch command and name it “release2017.05.24 - reason for fix”. This will make it obvious why the branch exists (for release fix).
  3. Make your changes, commit, push your changes up to the server (push your branch to origin).
  4. In your server create a pull request for your branch to merge to the release/2017.05.24 branch. NOTE: merging to release/2017.05.24 branch is NOT the default so be sure to change that before creating the pull request.
  5. On code review approval checkout “release/2017.05.24”
  6. Execute the merge command picking your commit in “release2017.05.24 -reason for fix” branch.
  7. Delete the local and remote branches for your “release2017.05.24 - reason for fix” branch

Hopefully that will work better. Lots of steps and brakes from the Git-flow command set but should allow the pull requests to happen.

like image 93
smurphy Avatar answered Nov 22 '22 07:11

smurphy


The way I handle it would be to have a hotfix branch off the release branch. After fixing the bug I would merge in to master/release branch and also merge to Dev branch which would then trickle down to the other features.

The hotfix would then be deleted because it'll be recorded in master or dev.

like image 22
Mike Tung Avatar answered Nov 22 '22 06:11

Mike Tung