简体   繁体   English

如何在git中处理主要版本分支

[英]How to deal with major version branch in git

I'm just switching a development project from SVN to git and it's the first time we'll be using branching of any kind. 我只是将开发项目从SVN切换到git,这是我们第一次使用任何类型的分支。 I'm wrapping my brain around the git-flow approach (based on this great article ), but am stuck conceptualizing how to do one thing. 我正在围绕git-flow方法包围我的大脑(基于这篇伟大的文章 ),但我很难理解如何做一件事。

When we do a major version bump (say from 2 to 3) we still support version 2 for at least a year, including bug fixes and occasional new features. 当我们做一个主要的版本颠簸(比如2到3)时,我们仍然支持版本2至少一年,包括错误修复和偶尔的新功能。 Would I create a new permanent branch for version 2 to apply those changes to? 我是否会为版本2创建一个新的永久分支以应用这些更改? And if we get down the road developing for version 3 and decide that we want to add a new version 3 feature into version 2, is that possible, and how would you do it? 如果我们开始开发版本3并决定我们想在版本2中添加新版本3功能,那可能吗,你会怎么做? Would I have to cherry-pick commits from the develop branch into the version-2 branch, or could I do an actual merge? 我是否必须从开发分支中挑选提交到版本2分支,或者我可以进行实际合并吗?

(I'm using Tower for my Git client) (我正在使用Tower作为我的Git客户端)

Yes, you would have a support branch and a development branch. 是的,你会有一个支持分支和一个开发分支。

Any bugfixes on the support branch will very likely also be relevant for the development branch, so the support branch should regularly be merged into the development branch. 支持分支上的任何错误修正很可能也与开发分支相关,因此支持分支应定期合并到开发分支中。 Note that the more your development version diverges, the more merge conflicts will you encounter. 请注意,您的开发版本越多,您遇到的合并冲突就越多。

The other case, a feature from development being relevant for support, should be rather the exception than the rule (otherwise you would have developed it in support in the first place), so these commits should be cherry-picked. 另一种情况是,开发中的一个特性与支持相关,应该是规则的例外(否则你首先会支持它),所以这些提交应该是挑选的。 Merging the development branch into the support branch should not happen, because you very likely have a lot of untested, unfinished or experimental features in there which you don't want to release as a support patch. 不应该将开发分支合并到支持分支中,因为您很可能在那里有许多未经测试,未完成或实验的功能,您不希望将其作为支持补丁发布。

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

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