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

前端 未结 7 1258
醉话见心
醉话见心 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:23

    You can prevent non-fast-forward updates by configuring denyNonFastForwards

    git config --system receive.denyNonFastForwards true
    

    But it applies for all branches. For more info please refer ProGit

提交回复
热议问题