简体   繁体   English

在gitflow模型中创建修补程序分支或功能分支

[英]Create a hotfix branch or a feature branch in gitflow model

I'm using this model in my team: 我在团队中使用此模型: 在此处输入图片说明

Today my project stats is following: 今天我的项目统计如下:

  • The stable version is running in production using master branch 稳定版正在使用master分支在生产中运行
  • We developed new functionalities that need to be tested before production, so we have a release branch be testing under SIT Environment . 我们开发了需要在生产之前进行测试的新功能,因此我们有一个发布分支正在SIT Environment下进行测试。 This new functionalities just can be merged with master after all tests in SIT Environment. 在SIT环境中进行所有测试后,可以将这些新功能与master合并。

The problem: The Product Owner requested a new field in a Table in Production. 问题: 产品负责人在生产表中请求了一个新字段。 So the team suggest two solutions: 因此,团队提出了两种解决方案:

  • Create a hotfix branch from master , add the new field and deploy to a Test Environment . 从master创建一个修补程序分支,添加新字段并部署到测试环境 This hotfix can wait months until merge with master, because after test pass we need wait the Product Owner say that can go to production because this field depends on another system changes. 此修复程序可能要等几个月才能与主服务器合并,因为在通过测试之后,我们需要等待产品负责人说可以投入生产,因为此字段取决于另一个系统更改。

  • Create a feature branch from develop and add this new field and deploy to a Test Environment . 从development创建一个功能分支,并添加此新字段并部署到测试环境 I think this is worst solution because i have things in develop that can't be merged to master, so i will need a cherry-pick to pick-up only desired changed from release to master. 我认为这是最糟糕的解决方案,因为我正在开发的东西无法合并到母版中,因此我将需要挑剔的技巧来仅选择从发行版到母版的所需更改。 Remember that team is validating others functionalities in SIT Environment (release branch). 请记住,团队正在验证SIT环境 (发布分支)中的其他功能。

If I create feature from develop branch I will got functionalities that don't should go to production in this new feature branch. 如果我从developer分支创建功能,那么我将获得不应该在此新功能分支中投入生产的功能。 Remember that I can't send develop to production yet 请记住,我还不能将开发项目发送到生产环境

Unhappy the big problem is not merge but the functionalities that can't go to master. 不幸的是,最大的问题不是合并,而是无法掌握的功能。 How can I send only this change without send all other features inside a develop or release branch? 我如何只发送此更改而又不发送开发或发行分支中的所有其他功能?

That means gitflow is not the workflow for you. 这意味着gitflow不是适合您的工作流程。
Switch to the gitworkflow (one word, illustrated here ). 切换到gitworkflow (一个词,如此处所示 )。
See more at rocketraman/gitworkflow . 参见rocketraman/gitworkflow

That kind of workflow (where you don't merge dev to master , but where you merge only feature branch to dev , then if selected, to master , in order to be able to drop easily feature branches not ready for the next release) is implemented in the Git repo itself. 那种工作流程(您不将dev合并到master ,而仅将Feature分支合并到dev ,然后将其合并到master ,以便能够轻松删除不准备用于下一版本的Feature分支的工作流程)在Git仓库本身中实现。

https://github.com/rocketraman/gitworkflow/raw/master/docs/images/topicgraduation.png

(source: Gitworkflow: A Task-Oriented Primer ) (来源: Gitworkflow:面向任务的入门

You have: 你有:

  • master is the branch ready to be deployed into production at any time: the next release, with a selected set of feature branches merged in master . master是随时可以部署到生产中的分支:下一个版本,具有选定的一组功能分支合并在master
  • dev (or integration branch, or ' next ') is the one where the feature branch selected for the next release are tested together dev (或集成分支,或“ next ”)是一起测试为下一版本选择的功能分支的分支
  • maintenance (or hot-fix ) branch is the one for the current release evolution/bug fixes, with possible merges back to dev and or master maintenance (或hot-fix )分支是当前版本Evolution / bug修复的分支, 并可能合并回dev和or master

Note: in that distributed workflow, you can commit whenever you want and push to a personal branch some WIP (Work In Progress) without issue: you will be able to reorganize (git rebase) your commits before making them part of a feature branch. 注意:在该分布式工作流中,您可以随时提交并向个人分支推送一些WIP(进行中的工作),而不会出现问题:您可以重新组织(git rebase)提交,然后再将它们纳入功能分支。

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

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