简体   繁体   English

开源项目上的Git分支模型

[英]Git branching model on Open Source project

We are developping on top of an Open Source project which use multiple versions branches: 我们正在使用多个版本分支的开源项目之上进行开发:

Ex: master , 1.1 (lts), 1.2 , 1.3 (lts), 2.0 .... 例如: master1.1 (LTS), 1.21.3 (LTS), 2.0 ....

We use in production the previous LTS in order to have most stable branch possible. 我们在生产中使用以前的LTS,以便获得最稳定的分支。

Our problem: 我们的问题:

We are curently on 1.1 and have hundreds of commits. 我们目前正在使用1.1并且有数百个提交。 (unmerged upstream PR, or internal changes). (未合并的上游PR或内部更改)。 We need to move to 1.3 我们需要移至1.3

There is a new version branch every 3 months. 每3个月有一个新版本的分支。 So this process must be as painless and efficient as possible 因此,此过程必须尽可能轻松高效

Possible solutions: 可能的解决方案:

  • Merging 1.1 into 1.3 . 1.1合并到1.3 Since the two trees have a long diverging tree, i am not sure if it's the best approach 由于两棵树有一棵长的分歧树,我不确定这是否是最佳方法
  • Cherry picking our commits from 1.1 to 1.3 . Cherry选择我们的承诺从1.11.3 Not sure it's the best idea, since we will have to cherry pick all theses commits from version to version. 不确定这是最好的主意,因为我们将不得不逐个挑选所有这些提交。

Do you have any suggestions or recommendations ? 您有什么建议或建议吗?

Thanks 谢谢

Could you have a "staging" branch between master and the release branches that you sync more frequently? 您能否在master和release分支之间有一个“ staging”分支,您可以更频繁地同步它?

See git flow where they call the staging branch develop: https://www.atlassian.com/git/tutorials/comparing-workflows#gitflow-workflow 在他们称为暂存分支的地方查看git flow: https : //www.atlassian.com/git/tutorials/comparing-workflows#gitflow-workflow

After a little more than a year, and many releases, we ended up doing the following : 经过一年多的时间,发布了许多版本,我们最终完成了以下工作:

First, we avoid making changes to the repository by using better suited extension points available. 首先,我们避免使用更合适的扩展点来对存储库进行更改。 This reduces by 90% the complexity of the merges. 这样可以将合并的复杂度降低90%。

When it's time to switch to a new branch, we are performing a cherry-pick of the previous branch changes on the new version. 当需要切换到新分支时,我们正在对新版本上的先前分支所做的修改。

This solution is working much better that expected initially. 该解决方案比最初预期的要好得多。 When conflicts occurs, they are easy to fix, and since most of our changes to this repository are also submitted via PR to the upstream project, the actual deltas are smaller and smaller with time. 当发生冲突时,它们很容易解决,并且由于我们对该存储库的大部分更改也都通过PR提交给了上游项目,因此实际增量随着时间而越来越小。

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

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