GitFlow,何时在分支之间合并

GitFlow, when to merge between branches

我已经向我的团队介绍了 GitFlow,现在我们正在使用以下分支结构,它与我们的内部工作流程完美融合:

当前结构

我们有 masterdev Sprint 的每一端使用带有 Sprint 名称的标签发出 拉取请求

我们有 dev 这是我们代码的来源,然后我们有一个 branch 用于我们正在开发的每个插件。

工作流程

如果您要开发新的 plugin/feature 我们将使用这种方法:

git checkout dev
git pull
git branch -b "your plugin"
...
git commit
git push origin "your plugin"
...
pull request from "your plugin" into dev

我的问题如下:

  1. 何时 dev 需要从我们的插件分支之一发出 pull request?每次都有push into "my plugin" branch?
  2. 如果开发人员正在处理 plugin02 并合并到 dev,我如何才能将更改也放入 plugin04 分支?
  3. 最后,如果有人直接在master上工作,例如紧急错误,我们如何重新同步所有子分支?当我们发出 pull request 时会发生这种情况吗?

首先澄清一下。

您写道:

We have master which makes a pull request from dev every end of Sprint using a TAG with the name of the Sprint.

拉取请求不是来自分支机构,而是来自您团队中的某个人。此外,标签不用于创建拉取请求,而是用于标记特定提交(即合并提交)。 如果您使用的是 gitflow,我建议使用 git flow release(参见 git-flow cheatsheet)在冲刺结束时创建版本。

  1. When dev need to issue a pull request from one of our plugin branches? Every time there is a push into "my plugin" branch?

通常,一旦功能分支准备好合并到开发分支(即功能满足完成的定义),您就会创建从功能分支到开发分支的拉取请求。

  1. If a Developer is working on plugin02 and merge into dev, how can I get the changes also into plugin04 branch?

通过将 dev 分支合并到 plugin04 分支,您将获得对 plugin04 分支的更改。

  1. Final, if someone works straight on master, like for an emergency bug, how can we re-sync all sub branches? Does this happen when we issue pull request?

在这种情况下,根据 gitflow,必须创建一个修补程序分支,然后将其合并回 masterdev(参见 git-flow cheatsheet)。由于修补程序将合并回 dev,您只需将 dev 分支合并到您的功能分支即可。