Project

General

Profile

Actions

bug #8105

open

better hotfix branch strategy in git flow to avoid commits in master which are missing in develop

Added by Andreas Kohlbecker about 5 years ago. Updated about 3 years ago.

Status:
In Progress
Priority:
Priority14
Category:
devOps
Target version:
Start date:
Due date:
% Done:

60%

Estimated time:
Severity:
major
Found in Version:
Tags:
git

Description

During the release of the taxeditor 5.5.0 it turned out, that the masterbranch has received commits from the hotfix/* barnch, which are not yet in den develop`:

In this commit the file eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java has been deleted.

This situation finally lead to a conflict when merging the release branch to master.

The git flow scheme clearly recommends merging all changes made to a hotfix branch back to develop. But this can not be done automatically since merge conflicts can are to be expected in this step with high propability.

A good strategy could be to verify just before finalizing the hotfix branch that all changes in the hotfix/* branch have been incorporated into develop. The git command cherry can be used to find commits that have been missed out.

This is illustrated here by a simple example:

  • hotfix branch 5.5.1 created
  • adding commit to develop: c6191df
  • adding commit to hotfix/5.5.1 : 305c21a (changes same line)

: git cherry develop hotfix/5.5.1
+ 305c21a613ed152685555559f1bdda4eaaed236b

Shows that exactly one commit is missing in develop

After merging hotfix/5.5.1 into develop and resolving the conflicts git cherry does not report any missing cherries.

*And the case which caused the problem during the release:

in this case we need to focus only to the current hotfix branch and will also specifying the <limit> argument for the cherry command:

: git cherry 2c28be6 5cb02a2 92f149d1f
+ e663916103a3e688714d14546aa664cef7f011c6
+ 8f3316f456dcafad1b9105ce2323cce5f915fb1a
+ 5cb02a236f205fd9c7b0b31d3b77fc24c7f8d99d

Without the limit git cherry would have reported all commit that once have been missed to integrate into develop of which many are no linger relevant for the actual release.

In the above example I needed to use the commit hashes since I was examining a historic situation. At the time of finalizing the hotfix release the command would have been:

git cherry develop hotfix/5.4.3 master

The only problem that needs to be solved is that we need to ignore the first commit in the hotfix branch since this is the commit by which the project version has been bumped by jenkins.

The first commit in a branch created by the release pipeline in jenkins can be found by e.g.:

git log --pretty=format:"%h" --author=jenkins master..hotfix/5.5.1 | tail -n 1   

HOW to use the git-hfx-cherry-check.sh script

assuming you have checked out the svn repository https://dev.e-taxonomy.eu/svn/trunk/server-scripts at ~/opt/server-scripts you can use the script in the following way:

~/opt/server-scripts/jenkins-ci/git-hfx-cherry-check.sh <hotfix-branch>

Files

picture794-1.png (67.7 KB) picture794-1.png Andreas Kohlbecker, 02/18/2019 12:22 PM
picture794-2.png (133 KB) picture794-2.png Andreas Kohlbecker, 02/18/2019 12:22 PM
picture205-1.png (96 KB) picture205-1.png Andreas Kohlbecker, 02/18/2019 12:40 PM

Related issues

Related to EDIT - feature request #7110: taxeditor hotfix script gitflow-finish.sh must not merge back to develop by defaultNewAndreas Kohlbecker

Actions
Actions

Also available in: Atom PDF