How can I prevent non-fastforward pushes to selected branch(es) in git?

fast-forward, git, git-push

Solution

You can use GitEnterprise to setup per-branch permissions (admin) to block non-fastforward pushes using fine-grained access permission.

And `git config --system receive.denyNonFastForwards true` will simply do the job if you need to block history changing for all branches.

Problem

I would like to protect my git repository so only non master branches can be overwritten. Is there a way to protect only selected branches?

Original source

Related problems