功能分支的 git flow

发布于 2025-01-20 08:28:55 字数 467 浏览 0 评论 0原文

团队当前的 git 流程。

总共 3 个分支

main
develop
feature

当我们处于开发阶段时
当有新的 jira 票证时,我们将从开发中创建一个功能分支。
完成该功能后,我们会将其合并到开发中。
当我们想要更新主分支时,我们会将开发合并到主分支中。

但是应用程序现在向公众开放,我们希望有更好的git流程。
像往常一样,如果我们完成了该功能,我们会将其合并到开发分支中。
然后测试人员将测试该功能是否完成且没有错误。
测试人员测试完毕后,他们会要求我们(开发人员)部署该功能,
这与之前的做法完全不同

例如,如果开发人员完成了功能 A,然后测试人员已经在开发分支中验证了它,之后我们只需将功能 A 合并到主分支中。

因此我想知道对于这种情况是否有任何建议的流程。

The current git flow for the team.

3 branches in total

main
develop
feature

When we're in the development stage
When there is a new jira ticket, we will create a feature branch from develop.
After completing the feature, we will merge the feature into develop.
When we want to update the main branch, we will merge develop into main branch.

But the application is now open to public, we want to have better git flow.
As usual, if we finish the feature, we will merge it into develop branch.
Then the tester will test if the feature is completed without bug.
Once the testers've tested, they will ask us(developers) to deploy ONLY that feature,
which is totally different from previous practice

For example, if developers complete feature A and then the testers've verified it in develop branch, after that we have to merge only feature A into main branch.

Therefore I want to know if there is any suggested flow for this situation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半步萧音过轻尘 2025-01-27 08:28:55

当您定期释放一组在单个commit 中存在状态的功能时,GIT流量最有效。这就是为什么GIT流建议从(commit on)开发创建Release分支的原因。这可能是一个或许多功能,但目的是发布该提交的所有功能。错误修复了这些功能的任何一个都可以在Release分支上完成,以便可以同时继续开发

考虑GIT流动的另一种方法是:

将代码合并到开发中后,它旨在将其与下一个版本一起部署(或此后的版本,如果当前有一个版本)。

即使您希望对工作流程进行的所需调整在概念上是微不足道的,但我相信您不应该再使用GIT流动了。如果您为每个功能制作了新的版本分支,则可以坚持使用GIT流,但是您需要按照它们创建的顺序发布它们,否则您最终需要需要要进行大量恢复以削减想要跳过的特定功能。

基于对您情况的描述,我提出的解决方案是使用GIT使用的维护者,该方法称为 gitworkflows 。更改将包括:

  1. 重命名您的开发分支为下一个
  2. 定期重置下一个 MAIN。 (每周一次,或迭代通常效果很好。)
  3. 将开发人员分支为main新功能。
  4. 将这些功能分支合并到下一个进行集成测试。
  5. 批准后,将这些功能分支合并到main中并部署到生产中。

话虽这么说,在我的公司中,在我们的一个较大的存储库中,我们实际上是两者兼而有之。我们使用git流几乎是“标准”方式(并且功能分支仍然来自开发),但是我们通过将它们合并到一个称为 Next 的分支中来验证这些功能。有时将它们修复并再次合并多次,然后最终将它们合并到开发中。当我们从开发创建一个版本分支时,它已经很好地硬化了,并且对Release> Release>分支上的错误修复通常很小。如果您希望有时会一起发布多个功能,则此混合工作流程可能对您有效。但是,如果您的正常用例是一次发布一项功能,那么我可能会考虑跳过GIT流的开销。

Git Flow works best when you periodically release a set of features whose state exists in a single commit. This is why Git Flow recommends creating a release branch from (a commit on) develop which you wish to test. This may be one feature or many, but the intention is that all of the features at that commit will be released. Bug fixes to any of those features are done on the release branch so that new development can simultaneously continue on develop.

Another way to think about Git Flow is this:

Once you merge your code into develop, it is intended to be deployed with the next release (or the one after that if there is currently one in progress).

Even though the desired tweak you wish to make to your workflow is conceptually trivial, I believe it's enough that you should no longer use Git Flow. You might be able to stick with Git Flow if you made a new release branch for every feature, but then you would need to release them in the order they were created, or else you'll end up needing to do a lot of reverting to cut out specific features you wish to skip.

Based on the description of your situation, my proposed solution is to use what the maintainers of Git use, which is called Gitworkflows. The changes would include:

  1. Rename your develop branch to next.
  2. Periodically reset next to main. (Once per week, or iteration often works well.)
  3. Have developers branch off of main for new features.
  4. Merge those feature branches into next for integration testing.
  5. Once approved, merge those feature branches into main and deploy to production.

That being said, at my company in one of our larger repos, we actually do a combination of both. We use Git Flow pretty much the "standard" way (and feature branches still come off of develop), but we validate the features by merging them into a branch called next, sometimes fixing them up and merging in again multiple times, before finally merging them into develop. By the time we create a release branch from develop it's already pretty well hardened, and bug fixes on the release branch are oftentimes minimal. This hybrid workflow may work well for you if you wish to sometimes release multiple features together. But if your normal use case is to release one feature at a time, then I'd probably consider skipping the overhead of Git Flow.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文