简体   繁体   English

gitflow为什么我们需要掌握

[英]gitflow why do we need master

in gitflow all release branches are eventually 在gitflow中,所有发布分支最终都是

  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. git分支命名约定master, develop & release被很好地定义并被采用来与普遍同步。 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 . 在mercurial中,Many跟随分支命名default而不是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 您可以参考This This This获取更多信息

For the main reason why master branch is necessary ( develop branch can not be replaced) in gitflow: 对于gitflow中需要master分支( develop分支不能替换)的主要原因:

  • All the versions on master branch should be stable enough since it's used for product environment. master分支上的所有版本都应该足够稳定,因为它用于产品环境。
  • While for develop branches, all the developers can push their work directly even with no validations. 而对于develop分支机构,即使没有验证,所有开发人员也可以直接推动他们的工作。 That means, develop branch may be "dirty", that will cause the production/living environment Collapsed. 这意味着, develop分支可能会“脏”,这将导致生产/生活环境崩溃。

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) 当你准备从主线发布分支(称之为发布/ r-1.2等)
  • 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 Merge / cherry将修补程序添加到您的发布分支中
  • 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 VSTS团队记录了这一点: https//docs.microsoft.com/en-gb/azure/devops/devops-at-microsoft/release-flow

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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