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

左心房为你撑大大i 提交于 2019-12-05 19:26:58

That is related to Foxtrot merges, specifcally prohibited on 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

If pushed:

The easiest way to avoid this problem is to always run "git pull --rebase" and to never run default "git pull". Here's a deep dive blog post on that: Too much fun with "git pull --rebase"

The reason you're encountering this problem is because your company has installed the free Control Freak plugin for Bitbucket and they have left its default Foxtrot Prevention control enabled for all branches.

If you're on Bitbucket Server 5.5 or newer you can rebase pull-requests directly from the pull request screen. Click on the "..." button on the far right of the pull-request screen and a "Rebase" menu item should be available.

Alternatively you can ask an admin to disable the foxtrot prevention. Even repo admins can do this (does not require global admins). But I don't recommend disabling this control since it prevents messy commit history.

Full disclosure: I wrote and maintain the free "Control Freak" plugin for Bitbucket Server.

Note: rebases and amends should never cause foxtrots. Typically only default "git pull" causes foxtrot merges, and "git pull -r" is a great remedy. The "git merge" command can also cause it, but it's rare for people to accidentally create a foxtrot merge when using "git merge" in typical scenarios that call for "git merge". I suspect 99% of the time it's "git pull" that is causing the problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!