简体   繁体   中英

gitflow why do we need master

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

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

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.

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://docs.microsoft.com/en-gb/azure/devops/devops-at-microsoft/release-flow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM