简体   繁体   English

Git分支/工作流模型,如“nvie gitflow”,但没有发布分支

[英]Git branching / workflow model like “nvie gitflow” but without release branches

Is there an official documented git workflow just like nvie's "Gitflow" workflow but without the release branches? 是否有官方记录的git工作流程就像nvie的“Gitflow”工作流程但没有发布分支?

http://nvie.com/posts/a-successful-git-branching-model/ http://nvie.com/posts/a-successful-git-branching-model/

https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow

I guess I don't see the purpose of the release branches, why not just tag a release from master? 我想我没有看到发布分支的目的,为什么不只是标记一个来自master的发布? (Maybe that's the same thing). (也许这是一回事)。

The concept of releases in the nvie's branching model (and consequently in the git-flow tool) is related to the distinction between the branches master and develop . nvie分支模型(以及git-flow工具)中的发布概念与分支masterdevelop之间的区别有关。 In both, nvie's model and GitHub's model, master is supposed to be 'fit for production'. 在nvie的模型和GitHub的模型中, master都应该“适合生产”。 But how can you ensure that? 但你怎么能确保呢?

why not just tag a release from master? 为什么不只是标记一个主人的版本?

GitHub's branching model does just that ... GitHub的分支模型就是这样......

If there are few concurrent feature branches, you simply test (and review, as well as any other QA you want or need) your feature branches before you merge them into master . 如果并发功能分支很少,您只需在将功能分支合并到master之前测试(并查看,以及您想要或需要的任何其他QA)功能分支。 If significant changes have been merged into master (or if changes have — in violation of the branching model — been directly committed to master ) since the respective feature branch was branched off, merge master into the feature branch before testing, so you're already testing an integrated state of your code. 如果已将重大更改合并到master (或者如果更改已经 - 违反分支模型 - 已直接提交给master ),因为相应的功能分支已分支,请测试之前master合并到功能分支中,因此您已经测试代码的集成状态。

For this, GitHub's branching model, as mentioned by Chase works perfectly fine. 为此,GseHub的分支模型,如Chase提到的非常好。

If releasing involves some code changes (eg bumping version numbers, summarizing changelogs), one can do this directly on master or on a dedicated branch. 如果发布涉及一些代码更改(例如,碰撞版本号,总结更改日志),可以直接在master或专用分支上执行此操作。 In any case, master serves here as both , integration and stable branch. 在任何情况下, master成为这里既是 ,整合和稳定分公司。

... but that's not enough for every project ......但这对每个项目都不够

If you apply GitHub's branching model in projects with many concurrent feature branches, and some of the latter not as short-lived as you might wish, it becomes likely that by the time you've tested and QAed your feature branch (with master merged into it), master has already changed by other merges, so you'd have to test all over. 如果你申请的项目GitHub的分支模型同时产生大量的功能分支,有的后者不是短暂的,你可能会想,它成为可能,到时候你已经测试并QAed您的特性分支(与master合并成it), master已经被其他合并改变了,所以你必须全部测试。 Also, with that much going on in the project, it might be difficult for you to know what all to test to ensure you didn't break any of the other (maybe just recently merged) features. 此外,随着项目的进展,您可能很难知道所有测试内容以确保您没有破坏任何其他(可能是刚刚合并的)功能。

nvie's master (stable) ↔ develop (integration) distinction nvie的master (稳定)↔ develop (整合)区别

Thus, in busy projects, it makes sense to have an integration / stabilization branch, where all feature branches will be merged after respectively having been tested and QAed individually . 因此,在繁忙的项目中,有一个集成/稳定分支是有意义的,其中所有特征分支将在分别经过单独测试和QAed之后合并。 This gives the chance to test and QA the feature implementations again in combination before deciding whether a given snapshot of this integration shall become a release and thereby declared 'fit for use'. 这使得有机会再次组合测试和QA功能实现,然后再决定此集成的给定快照是否应成为发布版本,从而声明“适合使用”。 Nvie's branching model calls this integration branch develop . Nvie的分支模型称这个集成分支develop master loses the integration role and just becomes the branch for the deemed-stable snapshots of develop . master失去了集成角色,只是成为develop的视图稳定快照的分支。

But wait — "snapshots" — isn't that exactly what Git tags provide? 但等等 - “快照” - 不正是Git标签提供的那些吗? Why the separate branch master , then? 为什么单独的分支master呢? And again: 然后再次:

why not just tag a release from 为什么不只是标记一个版本 master [develop]? [开发]?

Only for convenience: Users (or operators, deployment attachés, ...) who do not care what exact version they are using, as long as it is a stable version (or who want the latest and greatest stable version) can just check out master (and pull master to update), without having to look what tags there are and without having to figure out your version numbering scheme. 仅为方便起见:用户(或操作员,部署专员,...)谁不关心他们使用的确切版本,只要它是一个稳定的版本(或谁想要最新和最稳定的版本)可以检查出来master (和pull master to update),无需查看有哪些标签,也无需弄清楚你的版本编号方案。

Release branches 发布分支机构

I always thought releases as being static clones, not dynamic branches. 我一直认为发布是静态克隆,而不是动态分支。

They are. 他们是。 A release branch is not a finished release. 发布分支不是完成版本。 It's a release-in-preparation. 这是一个准备中的发布。 It's used to bump version numbers, and perform other code changes that you might not want to do on feature branches (eg, because they obfuscate the actual implementation changes) but that are necessary for the finished software. 它用于破坏版本号,并执行您可能不想在功能分支上执行的其他代码更改(例如,因为它们模糊了实际的实现更改),但这对于完成的软件是必需的。 (Eg syncing translation files with the UI strings actually needed in the application.) (例如,将翻译文件与应用程序中实际需要的UI字符串同步。)

Release branches can be arbitrarily short-lived. 发布分支可以是任意短暂的。 Once you're confident with your release preparations, you merge the release branch to develop and master , additionally placing a tag and then delete the release branch . 一旦您对发布准备工作充满信心,就可以合并发布分支以developmaster ,另外放置一个标记,然后删除发布分支

Do not use release branches for maintaining a version. 不要使用发布分支来维护版本。 That's what hotfix and (in more recent versions of the git-flow tool) support branches are for. 这就是hotfix和(在更新版本的git-flow工具中)支持分支的用途。

Why not do all those releasing commits directly on develop ? 为什么不能做所有这些释放直接提交上develop Well, if they take longer (or if they require cooperation and therefor need publishing of intermediate states), having them on a dedicated release branch allows you to have control over what makes it into the release and what doesn't, without having to block develop for further integration of features that become ready while you're busy releasing. 好吧,如果他们需要更长的时间(或者如果他们需要合作,因此需要发布中间状态),将它们放在专用的发布分支上可以让你控制什么使它成为发行版,什么不发布,而不必阻止develop用于进一步集成在您忙于发布时准备就绪的功能。

Release branches in git flow git flow释放分支

Even if your releases require no additional steps, because you didn't put the version of your project into the repository's content and don't have to update the used versions of third-party dependencies, and don't postpone updating your translations, etc., it might be worth to use the release subcommands of git flow , because they help you not to forget important rules of nvie's branching model, by automating them: 即使您的版本不需要额外的步骤,因为您没有将项目的版本放入存储库的内容中,也不必更新已使用的第三方依赖项版本,也不会推迟更新您的翻译等。,使用git flowrelease子命令可能是值得的,因为它们可以帮助你不要忘记nvie分支模型的重要规则,通过自动化它们:

  • merge the release branch into both, master and develop 将发布分支合并为两者, master develop
  • tag the release consistently 始终如一地标记版本
  • actually delete the release branch when done 实际上删除发布分支

If releasing doesn't require cooperation (or doesn't involve dedicated steps at all in your project), you can 如果发布不需要合作(或者您的项目中根本不涉及专门的步骤),您可以

git flow release start <version number>
git flow release finish <same version number>

without ever pushing the release branch before finish deletes it again (after merging and tagging, which is the effect you'd want). 没有在finish之前推动释放分支再次删除它(在合并和标记之后,这是你想要的效果)。

To make the resulting release visible to the world, then 为了使得到的版本对世界可见,那么

git push origin develop master <version you just released>

so that the merges on both branches and the new tag will be sent to origin . 这样两个分支和新标签上的合并将被发送到origin

If you have pushed the release branch (be it manually or with git flow publish release <version number> ), instead use 如果您已经推送了发布分支(无论是手动还是使用git flow publish release <version number> ),而是使用

git push origin :release/<version number> develop master <version number>

There's a pretty good simplified version provided here by Github. Github提供一个非常好的简化版本。

Here is one with tagging that I send to all of our new employees. 是我发送给所有新员工的标签。

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

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