How to Protect a Branch
If you are using Gitlab as I am now,
Go to 1. Settings
then 2. /repository
Expand 3. Protected branches
Protect your branch.
I suggest, for master branch, put Allowed to merge to maintainers; Allowed to push to No one. And of course disable force push; Code owner approval should be left on.