summaryrefslogtreecommitdiff
path: root/doc/user/project/protected_branches.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/user/project/protected_branches.md')
-rw-r--r--doc/user/project/protected_branches.md51
1 files changed, 36 insertions, 15 deletions
diff --git a/doc/user/project/protected_branches.md b/doc/user/project/protected_branches.md
index 06396b5cd62..56f5a2d24ff 100644
--- a/doc/user/project/protected_branches.md
+++ b/doc/user/project/protected_branches.md
@@ -10,7 +10,7 @@ In GitLab, [permissions](../permissions.md) are fundamentally defined around the
idea of having read or write permission to the repository and branches. To impose
further restrictions on certain branches, they can be protected.
-The default branch for your repository is protected by default.
+The [default branch](repository/branches/default.md) for your repository is protected by default.
## Who can modify a protected branch
@@ -39,7 +39,8 @@ Prerequisite:
To protect a branch:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to merge** list, select a role, or group that can merge into this branch. In GitLab Premium, you can also add users.
@@ -50,13 +51,18 @@ The protected branch displays in the list of protected branches.
## Configure multiple protected branches by using a wildcard
+If both a specific rule and a wildcard rule apply to the same branch, the most
+permissive rule controls how the branch behaves. For merge controls to work properly,
+set **Allowed to push** to a broader set of users than **Allowed to merge**.
+
Prerequisite:
- You must have at least the Maintainer role.
To protect multiple branches at the same time:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, type the branch name and a wildcard.
For example:
@@ -88,7 +94,8 @@ from the command line or from a Git client application.
To create a new branch through the user interface:
-1. Go to **Repository > Branches**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Repository > Branches**.
1. Select **New branch**.
1. Fill in the branch name and select an existing branch, tag, or commit to
base the new branch on. Only existing protected branches and commits
@@ -96,21 +103,28 @@ To create a new branch through the user interface:
## Require everyone to submit merge requests for a protected branch
-You can force everyone to submit a merge request, rather than allowing them to check in directly
-to a protected branch. This is compatible with workflows like the [GitLab workflow](../../topics/gitlab_flow.md).
+You can force everyone to submit a merge request, rather than allowing them to
+check in directly to a protected branch. This setting is compatible with workflows
+like the [GitLab workflow](../../topics/gitlab_flow.md).
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to merge** list, select **Developers + Maintainers**.
1. From the **Allowed to push** list, select **No one**.
+
+ NOTE:
+ Setting a role, group or user as **Allowed to push** also allows those users to merge.
+
1. Select **Protect**.
## Allow everyone to push directly to a protected branch
You can allow everyone with write access to push to the protected branch.
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to push** list, select **Developers + Maintainers**.
@@ -137,7 +151,8 @@ Prerequisites:
To allow a deploy key to push to a protected branch:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to push** list, select the deploy key.
@@ -155,7 +170,8 @@ protected branches.
To protect a new branch and enable force push:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to push** and **Allowed to merge** lists, select the settings you want.
@@ -166,7 +182,8 @@ To protect a new branch and enable force push:
To enable force pushes on branches that are already protected:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. In the list of protected branches, next to the branch, turn on the **Allowed to force push** toggle.
@@ -181,7 +198,8 @@ For a protected branch, you can require at least one approval by a [Code Owner](
To protect a new branch and enable Code Owner's approval:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. From the **Branch** dropdown list, select the branch you want to protect.
1. From the **Allowed to push** and **Allowed to merge** lists, select the settings you want.
@@ -190,7 +208,8 @@ To protect a new branch and enable Code Owner's approval:
To enable Code Owner's approval on branches that are already protected:
-1. Go to your project and select **Settings > Repository**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Settings > Repository**.
1. Expand **Protected branches**.
1. In the list of protected branches, next to the branch, turn on the **Code owner approval** toggle.
@@ -221,9 +240,11 @@ for details about the pipelines security model.
Users with at least the Maintainer role can manually delete protected
branches by using the GitLab web interface:
-1. Go to **Repository > Branches**.
+1. On the top bar, select **Menu > Projects** and find your project.
+1. On the left sidebar, select **Repository > Branches**.
1. Next to the branch you want to delete, select **Delete** (**{remove}**).
-1. On the confirmation dialog, type the branch name and select **Delete protected branch**.
+1. On the confirmation dialog, type the branch name.
+1. Select **Yes, delete protected branch**.
Protected branches can only be deleted by using GitLab either from the UI or API.
This prevents accidentally deleting a branch through local Git commands or