控制狂:提交被拒绝。 Bitbucket 中不允许 Foxtrot 合并

Control Freak: Commit rejected. Foxtrot merges not allowed in Bitbucket

到底是什么原因Control Freak: Commit rejected. Foxtrot merges not allowed

我们经常收到这个错误,这是由于用户在提交时同时使用 pullrebaseamend 造成的吗?

需要清楚地永久摆脱这个。我知道并理解该分支已经发生分歧并且它已经失去了踪迹但是究竟是什么导致了这种情况发生在简单的语言中是非常值得理解的

每当我们看到这个错误时,每次都重新设置基准对我们来说是一个时间杀手。我们正在手动 cherry-picking 更改以摆脱此问题。

如何识别提交的类型,比如在之后的正确提交 rebase 或 pull 或 amended 以及这到底是提交和由 谁?

我们想教育开发人员从类似的提交错误中走出来 今后。很想听听最佳实践。

此外,想了解像git-bash/source-tree这样的组合工具有什么理由吗?

我们可以关闭这个原因吗?

Foxtrot merges 有关,在 BitBucket 上明确禁止:

A foxtrot merge is a specific sequence of git commits. A particularly nefarious sequence. Out in the open, in lush open grasslands, the sequence looks like this:

But foxtrots are rarely seen in the open. They hide up in the canopy, in-between the branches. I call them foxtrots because, when caught mid-pounce, they look like the foot sequence for the eponymous ballroom dance:

Foxtrot merges are bad because they change origin/master’s first-parent history.

The parents of a merge commit are ordered. The first parent is HEAD. The second parent is the commit you reference with the git merge command.

You can think of it like this:

git checkout 1st-parent
git merge 2nd-parent

如果推送:

如“”中所述,提交“D”是一次狐步合并,因为“origin/master”是其第二个父项。
这是一个pull (fetch + merge)的结果
一旦狐步合并 D 被推送...'origin/master' 的第一父历史不再包含提交'B'!

torek in "how to avoid foxtrot merge in git", this is the result of working directly on master (new commit C), and doing a git pull (instead of a pull --rebase, )

所述

这会将 BC 合并到 D(狐步舞合并),这意味着 origin/master 不再具有 B 作为直接祖先,但是 C.
您的工作 'C' 现在成为主要发布的分支历史记录 (origin/master),而不是 B,降级为已合并的内容。

避免此问题的最简单方法是始终 运行 "git pull --rebase" 而从不 运行 默认 "git pull"。这是一个深入探讨的博客 post:Too much fun with "git pull --rebase"

您遇到此问题的原因是您的公司安装了为所有分支机构启用的免费 Control Freak plugin for Bitbucket and they have left its default Foxtrot Prevention 控件。

如果您使用的是 Bitbucket Server 5.5 或更新版本,您可以直接从拉取请求屏幕重新设置拉取请求的基线。单击拉取请求屏幕最右侧的“...”按钮,应该会出现一个 "Rebase" 菜单项。

或者,您可以要求管理员禁用狐步舞预防。甚至回购管理员也可以做到这一点(不需要全局管理员)。但我不建议禁用此控件,因为它可以防止混乱的提交历史。

完全披露:我为 Bitbucket Server 编写并维护了免费的 "Control Freak" 插件。

注意:变基和修改绝不能引起狐步舞。通常只有默认的 "git pull" 会导致狐步合并,而 "git pull -r" 是一个很好的补救措施。 "git merge" 命令也可能导致它,但很少有人在需要 "git merge" 的典型场景中使用 "git merge" 时意外创建狐步舞合并。我怀疑 99% 的时间是 "git pull" 导致了问题。