Block pushes containing foxtrot merges
Problem to solve
Foxtrot merges happen when the parents of a merge commit are in the wrong order, and are bad because they change origin/master’s first-parent history.
GitLab should protect users from these mistakes.
Further details
We want git log --first-parent
to be a consistent history for protected branches. (Well, a few others too, but protected ones would be a good start.)
If one of these branches appears as the second parent of a commit that is then pushed to that branch, the first parent line will contain the commits of the feature branch for that interval, hiding the commits on the protected branch.
This problem is called foxtrot merging, there is a question about it on StackOverflow: http://stackoverflow.com/questions/35962754/git-how-can-i-prevent-foxtrot-merges-in-my-master-branch
I can prevent this with a custom pre-push hook, in fact I already have, but I think this would make a good Push Rule.
Proposal
Add a push rule that prevents foxtrot merges