Some contributors in our project likes to work on master directly and still forget to git pull --rebase
.
Is there a way to refuse on the server side commit with commit like Merge branch 'master' of ... into master
?
Some contributors in our project likes to work on master directly and still forget to git pull --rebase
.
Is there a way to refuse on the server side commit with commit like Merge branch 'master' of ... into master
?
As VonC comments, you can do this with a simpler version of the
pre-receive
hook that I wrote for that question.To rephrase what you're asking, you would like a
pre-receive
hook on your server that will refuse any push to master which has any non-linear history, i.e. introduces any commit with more than one parent. This hook should do what you want:Update: in Jefromi's answer to the linked question, he demonstrates that using
git rev-list --merges
is much neater, so I've updated this script to use that, and fixed it to loop over every ref that the push is trying to update.