6

in gitflow all release branches are eventually

  1. merge to master
  2. merge to develop
  3. tag master
  4. delete the release branch

but why don't we just

  1. tag the release branch
  2. merge to develop
  3. delete the release branch

in case of hotfix we can just

  1. branch of the latest tag
  2. do the hotfix
  3. tag that hot fix branch
  4. merge to develop
  5. delete the hotfix branch

3 Answers3

2

You are almost describing a release-flow branching model:

  • Developers merge with a common mainline branch (call it develop or master)
  • When you are ready to release branch from mainline (call it release/r-1.2 etc)
  • When you find an issue with the new release create a hotfix branch (hotfix/fix-something)
  • Merge your hotfix into your mainline as you would ordinary dev
  • Merge/cherry pick the hotfix into your release branch
  • The release branch represents production when it is deployed to that environment

There is no final merge to a production branch - its not needed as the release branch is the same thing.

Once an old release branch has been superceeded by the next one it can be deleted if no longer required for audit purposes.

This is documented well by the VSTS team: https://learn.microsoft.com/en-gb/azure/devops/devops-at-microsoft/release-flow

James
  • 433
  • 4
  • 14
0

Let me try to put my understand here,

The git branch naming convention master, develop & release were well defined and adopted to sync with universally. That doesn't means you need to follow, you can define how you wish and push to your costumers and users, Many organisation follows universal naming conventions to avoid unnecessary confusion.

In mercurial, Many follows branch naming default instead of master.

Definition in one line:

master  : Ready Product (Public Available)

develop : Requirements/bugs/Improvements Implementation In Progress (Not recommended to use)

release : Preparing to `Ready Product` (Private or internal)

tag master : Stable Product with defined features.

You can refer This This This for more info

ntshetty
  • 1,293
  • 9
  • 20
  • I'd say a convention where `master` is used for current development is not less popular, and it keeps rising as supported by major providers like github and atlassian. – max630 Apr 26 '18 at 04:36
  • 2
    but why do you need "master: Ready Product" branch any tag should be "Ready Product" that can branched of – Mahmoud Adel Farid Apr 26 '18 at 06:59
  • @MahmoudAdelFarid let say you need to implement 100 features and working in agile. decided to deliver in 5 mile stones. it means each milestone should implement 20 features. In this case. `develop` branch get merge with `master` by 5 times(once in each mile stone) it's good to have `tag` for each mile stone to keep track. – ntshetty Apr 26 '18 at 10:24
0

For the main reason why master branch is necessary (develop branch can not be replaced) in gitflow:

  • All the versions on master branch should be stable enough since it's used for product environment.
  • While for develop branches, all the developers can push their work directly even with no validations. That means, develop branch may be "dirty", that will cause the production/living environment Collapsed.
Marina Liu
  • 36,876
  • 5
  • 61
  • 74
  • 3
    But if you use a tag on develop branch to indicate versions deployed to production, you can branch from the tag, do the hotfix, deploy, and merge back to develop. – luizfzs Aug 16 '18 at 14:44