how to protect a branch

Written by DEL support01
Updated 7 months ago

When working on on repo with multiple people , you have to set some rules to restrict access, or better organize.

In the repo Settings, you click on the Branches section, then on Add branch protection rule

You specify the name of the branch, you then go down and check the options that suit your needs, like a minimal number of reviewers approval needed..
when it s not matched , the merge can t happen

you can see it s mandatory to get a review on your PR before be allowed to merge

there are many rules, like even lock the branch so nothing can be pushed on that branch... 
Even allowing specific users to bypass some restrictions

you create your exceptions with the collaborators you want, then you go on and click on create

some rules are locked for private repos when under the free github version.

Did this answer your question?