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

前端 未结 7 1264
醉话见心
醉话见心 2020-12-10 06:46

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?

7条回答
  •  温柔的废话
    2020-12-10 07:18

    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.

提交回复
热议问题