Protection from merge commits

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Sep 12 00:20:34 UTC 2013


On Wed, Sep 11, 2013 at 06:35:54PM -0400, Sam Varshavchik wrote:
> Pete Zaitcev writes:
> 
> >Dear All:
> >
> >I found that I pushed a merge node into Fedora git (fortunately it was
> >only on f19 branch, not in Rawhide):
> >
> >commit 51eec48c20ba57054f17ba29f23e6a0aa36df9a4
> >Merge: ac36771 f9213a5
> >Author: Pete Zaitcev <zaitcev at kotori.zaitcev.us>
> >Date:   Wed Aug 7 12:14:15 2013 -0600
> >
> >    Merge branch 'f19' of
> >ssh://pkgs.fedoraproject.org/openstack-swift into f19
> >
> >Thought I was careful about them, but apparently not enough. So, does
> >anyone have a script that can be attached to git hooks, reliably detects
> >an attempt to push merge nodes, then bails the push?
> 
> The problem isn't the push, it's the merge.
> 
> When doing a merge, always merge with the --ff-only flag.
Or better yet, do 

  git config --global branch.autosetuprebase true

and turn git pull into git pull --rebase (see git-config(1)).
Merges are evil, and better only done explicitly.

Zbyszek


More information about the devel mailing list