git 开发与功能分支类型之间有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39585900/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:17:17  来源:igfitidea点击:

What is the difference between develop vs. feature branch type?

gitgit-flow

提问by Do Nhu Vy

I read few articles about Git flow best practices. There are many types of git branch (for example: [1], [2]):

我读了几篇关于 Git 流程最佳实践的文章。git branch 有很多种(例如:[1], [2]):

+ Master
+ Develop
+ Feature
+ Bug
+ Proof of concept
+ Release
+ Hotfix

What is the difference between types Mastervs. Release?

类型MasterRelease?之间有什么区别?

What is the difference between types Featurevs. Develop?

类型FeatureDevelop?之间有什么区别?

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

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

[2] http://developer.exoplatform.org/#id-branching-model

[2] http://developer.exoplatform.org/#id-branching-model

回答by MikeMB

For the git workflow, as presented in [1]:

对于 git 工作流程,如 [1] 中所示:

  • feature: All features / new functions / major refactorings are done in featurebranches, which branch off and are merged back into the developbranch (usually after some kind of peer review).
  • release: When enough features have accumulated or the next release time frame comes near, a new releasebranch is branched off develop. It is solely dedicated to testing/bug fixing and any cleanup necessary (e.g. changing some path names, different default values for instrumentation etc.).
  • masterOnce the QA is satisfied with the quality, the releasebranch is merged into master(and also back to develop). This is then what is shipped/used by the customers.
  • hotfixIf a major problem is found after release, the fix is developed in a hotfixbranch, that is branched off the master. Those are the only branchesthat will ever branch off of master.
  • Note: Any commit in masteris a merge commit (either from a releaseor a hotfixbranch) and represents a new release that is shipped to the customer.
  • feature:所有特性/新功能/主要重构都在feature分支中完成,分支分支并合并回develop分支(通常在某种同行评审之后)。
  • release:当积累了足够的功能或下一个发布时间框架临近时,就会release分支出一个新分支develop。它专门用于测试/错误修复和任何必要的清理(例如,更改某些路径名称、检测的不同默认值等)。
  • master一旦 QA 对质量感到满意,release分支就会合并到master(并返回到develop)。这就是客户运送/使用的内容。
  • hotfix如果在发布后发现重大问题,则在一个hotfix分支中开发修复程序,该分支是从 master 分支出来的。这些是唯一会从 master 分支出来的分支。
  • 注意:任何提交master都是合并提交(来自一个release或一个hotfix分支)并代表交付给客户的新版本。

Please be aware that this model is mainly meant for a) big software projects that follow b) classic release versioning and c) have a separate QA team. Many popular repositories on GitHub follow a simpler model.

请注意,此模型主要用于 a) 遵循 b) 经典发布版本控制的大型软件项目和 c) 拥有单独的 QA 团队。GitHub 上的许多流行存储库都遵循更简单的模型。

回答by slebetman

The difference between masterand releaseis that the masterbranch is what your customers/users are using. It is the branch actually installed or sold.

之间的区别master,并release是该master分支是你的客户/用户使用的是什么。它是实际安装或销售的分支。

In a lot of teams the masterbranch (usually also named master) is also the releasebranch. But this is not always the case. In larger companies or companies with a separate test or QA department/team the master branch is the branch that's being sold to customers but the release branch is the one being tested. Note that for some projects running a full test may take a week or more so it makes sense to have a branch that testers can test but is stable (developers don't constantly push updates).

在很多团队中,master分支(通常也称为master)也是release分支。但情况并非总是如此。在较大的公司或拥有单独测试或 QA 部门/团队的公司中,主分支是销售给客户的分支,但发布分支是被测试的分支。请注意,对于某些项目,运行完整测试可能需要一周或更长时间,因此拥有一个测试人员可以测试但稳定的分支是有意义的(开发人员不会不断推送更新)。

The difference between featureand developcomes from the same reasoning. The developbranch (usually named developor dev) is the stable developer's branch. In traditional source control software the develop branch is your repo server. It is the branch all developers have in common. It is the branch you start development with.

feature和之间的区别develop来自相同的推理。该develop分支(通常名为developdev)是稳定开发的分支。在传统的源代码控制软件中,开发分支是你的仓库服务器。这是所有开发人员的共同分支。它是您开始开发的分支。

A feature branch on the other hand is your own personal branch. During development of a feature/story/module you will of course modify the code a lot. And to take advantage of git you should commit early and commit often. But the code you're working on is by definition unstable (not finalized) and may cause breaking changes to other developers. So you develop on your own branch (branched off from develop) until your code is ready to be merged back to develop.

另一方面,功能分支是您自己的个人分支。在功能/故事/模块的开发过程中,您当然会大量修改代码。为了利用 git,你应该尽早提交并经常提交。但是您正在处理的代码根据定义是不稳定的(未完成),并且可能会导致其他开发人员发生重大更改。所以你在你自己的分支上开发(从开发分支),直到你的代码准备好合并回开发。

回答by jeremy

Just because no one has said it in a clear statement yet, and this would have answered the question for me...

仅仅因为还没有人在明确的声明中说出来,这将为我回答这个问题......

What is the difference between types Mastervs. Release?

What is the difference between types Featurevs. Develop?

类型Master与类型之间有什么区别?Release?

类型FeatureDevelop?之间有什么区别?

There is no difference.

没有区别。

Branch names are conventions established by teams, not rules enforced by git.

分支名称是团队建立的约定,而不是git 强制执行的规则

Git doesn't care what you call your branches, how many sub branches you create, when you merge them, etc. etc. etc. To Git... a branch is a branch is a branch.

Git 不关心你怎么称呼你的分支,你创建了多少子分支,什么时候合并它们等等等等。对 Git 来说……一个分支就是一个分支就是一个分支。

On many teams the names of branches follow a defined convention simply for ease of shared understanding... but as we see so often, your convention doesn't matter to the technology. It takes a human to give a concept meaning, so feel free to name your branches in whatever manner you find meaningful.

在许多团队中,分支的名称遵循定义的约定,只是为了便于共享理解……但正如我们经常看到的,您的约定与技术无关。赋予概念意义需要人类,因此请随意以您认为有意义的任何方式命名您的分支。