git工作流与3个分支的建议 [英] git workflow with 3 branches advice

查看:82
本文介绍了git工作流与3个分支的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个项目,在那里我们试图以最有效的方式来使用git(对于我们来说),并决定为2个子小组创建2个分支, master分支。



有时我们会承认主人是否应该进入两个分支,然后我们希望在其他分支中进行这些更改。 p>


  1. 这应该是合并还是分入其他两个分支?


  2. 这是一个疯狂的工作流程吗?如果是这样,建议请!


解决方案

我没有看到重点为两队创造两个分支。工作应该根据其性质来分开,而不是由谁来完成。



这是我的建议:


  • 使用功能分支:您的大部分工作都应该在这些主题分支上,除了微小的提交(例如错别字等)。
    当您有功能,错误修复或应该被处理:创建一个分支 feat-something ,并在那里工作。

  • 使用 dev release-X (其中 X 是发行版的编号)分支:当一个功能的分支工作完成,测试并运行时,将其重新绑定到 dev 中。

  • 永远不要在 master 上提交,这个分支只能由首席开发人员,首席技术官来重新设计。当你觉得需要的时候,将 的工作重定向到 master 中。



这是(基本上)我们如何处理一个非常大的项目。如果你的项目不大,你可以在没有 dev 分支的情况下工作。

查看这篇着名的文章,展示了一个相当出色的工作流程:一个成功的Git分支模型

I'm working on a project where we're trying to get to grips with using git in the most efficient manner (for us) and have decided to create 2 branches for 2 sub-teams to work on, along side the master branch.

Sometimes we will commit into master if it's something generic that should go into both branches and then we want those changes in the both of the other branches.

  1. Should that be a merge or a rebase into the 2 other branches?

  2. Is this an insane workflow to be going down the route of? If so, suggestions please!

解决方案

I don't see the point of creating two branches for two teams. Work should be separated depending on its nature, not on who will work on it.

This is what I'd suggest:

  • Use feature branches: Most of your work should be on these topic branches, except tiny commits (such as typos, etc.).
    When you have a feature, bug fix, or a ticket that should be processed: create a branch feat-something, and work in there.
  • Use a dev, or release-X (where X is the release's number) branch: When a feature's branch work is done, tested, and works, rebase it into dev.
  • Never commit on master, this branch should only be rebased into by the lead developer, CTO, whatever. Rebase dev's work into master when you feel it's needed.

This is (basically) how we work on a very big project. You can work without the dev branch if your project isn't big.

Check out this famous article that shows a pretty well done workflow: A successful Git branching model.

这篇关于git工作流与3个分支的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆