%p Keep stable branches secure and force developers to use merge requests.
%p Keep stable branches secure and force developers to use merge requests.
%p.prepend-top-20
%p.prepend-top-20
Protected branches are designed to:
By default, protected branches are designed to:
%ul
%ul
%li prevent pushes from everybody except #{link_to"masters",help_page_path("user/permissions"),class: "vlink"}
%li prevent their creation, if not already created, from everybody except Masters
%li prevent anyone from force pushing to the branch
%li prevent pushes from everybody except Masters
%li prevent anyone from deleting the branch
%li prevent <strong>anyone</strong> from force pushing to the branch
%p.append-bottom-0 Read more about #{link_to"project permissions",help_page_path("user/permissions"),class: "underlined-link"}
%li prevent <strong>anyone</strong> from deleting the branch
%p.append-bottom-0 Read more about #{link_to"protected branches",help_page_path("user/project/protected_branches"),class: "underlined-link"} and #{link_to"project permissions",help_page_path("user/permissions"),class: "underlined-link"}.
Navigate to project settings page and select `protected branches`. From the `Branch` dropdown menu select the branch you want to protect.
Some workflows, like [GitLab workflow](gitlab_flow.md), require all users with write access to submit a Merge request in order to get the code into a protected branch.
Since Masters and Owners can already push to protected branches, that means Developers cannot push to protected branch and need to submit a Merge request.
However, there are workflows where that is not needed and only protecting from force pushes and branch removal is useful.
For those workflows, you can allow everyone with write access to push to a protected branch by selecting `Developers can push` check box.
On already protected branches you can also allow developers to push to the repository by selecting the `Developers can push` check box.
![Developers can push](protected_branches/protected_branches2.png)
## Wildcard Protected Branches
>**Note:**
This feature was added in GitLab 8.10.
1. You can specify a wildcard protected branch, which will protect all branches matching the wildcard. For example:
1. Protected branch settings (like "Developers Can Push") apply to all matching branches.
1. Two different wildcards can potentially match the same branch. For example, `*-stable` and `production-*` would both match a `production-stable` branch.
>**Note:**
If _any_ of these protected branches have "Developers Can Push" set to true, then `production-stable` has it set to true.
1. If you click on a protected branch's name, you will be presented with a list of all matching branches: