diff --git a/assets/images/help/repository/lock-branch-forksync.png b/assets/images/help/repository/lock-branch-forksync.png new file mode 100644 index 0000000000..309f2e944f Binary files /dev/null and b/assets/images/help/repository/lock-branch-forksync.png differ diff --git a/assets/images/help/repository/lock-branch.png b/assets/images/help/repository/lock-branch.png new file mode 100644 index 0000000000..b93442c1e7 Binary files /dev/null and b/assets/images/help/repository/lock-branch.png differ diff --git a/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md b/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md index df9e94f9bc..ae7c873c86 100644 --- a/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md +++ b/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md @@ -54,6 +54,9 @@ For each branch protection rule, you can choose to enable or disable the followi {%- ifversion required-deployments %} - [Require deployments to succeed before merging](#require-deployments-to-succeed-before-merging) {%- endif %} +{%- ifversion lock-branch %} +- [Lock branch](#lock-branch) +{%- endif %} {% ifversion bypass-branch-protections %}- [Do not allow bypassing the above settings](#do-not-allow-bypassing-the-above-settings){% else %}- [Include administrators](#include-administrators){% endif %} - [Restrict who can push to matching branches](#restrict-who-can-push-to-matching-branches) - [Allow force pushes](#allow-force-pushes) @@ -155,6 +158,13 @@ Before you can require a linear commit history, your repository must allow squas You can require that changes are successfully deployed to specific environments before a branch can be merged. For example, you can use this rule to ensure that changes are successfully deployed to a staging environment before the changes merge to your default branch. +{% ifversion lock-branch %} +### Lock branch + +Locking a branch ensures that no commits can be made to the branch. +By default, a forked repository does not support syncing from its upstream repository. You can enable **Allow fork syncing** to pull changes from the upstream repository while preventing other contributions to the fork's branch. +{% endif %} + {% ifversion bypass-branch-protections %}### Do not allow bypassing the above settings{% else %} ### Include administrators{% endif %} diff --git a/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md b/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md index 07c0102f09..bef4499ff6 100644 --- a/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md +++ b/content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md @@ -103,6 +103,12 @@ When you create a branch rule, the branch you specify doesn't have to exist yet 1. Optionally, to choose which environments the changes must be successfully deployed to before merging, select **Require deployments to succeed before merging**, then select the environments. ![Require successful deployment option](/assets/images/help/repository/require-successful-deployment.png) {%- endif %} +{% ifversion lock-branch %} +1. Optionally, select **Lock branch** to make branch read-only. +![Screenshot of the checkbox to lock a branch](/assets/images/help/repository/lock-branch.png) + - Optionally, to allow fork syncing, select **Allow fork syncing**. +![Screenshot of the checkbox to allow fork syncing](/assets/images/help/repository/lock-branch-forksync.png) +{%- endif %} 1. Optionally, select {% ifversion bypass-branch-protections %}**Do not allow bypassing the above settings**. ![Do not allow bypassing the above settings checkbox](/assets/images/help/repository/do-not-allow-bypassing-the-above-settings.png){% else %}**Apply the rules above to administrators**. ![Apply the rules above to administrators checkbox](/assets/images/help/repository/include-admins-protected-branches.png){% endif %} diff --git a/data/features/lock-branch.yml b/data/features/lock-branch.yml new file mode 100644 index 0000000000..d2e92315f6 --- /dev/null +++ b/data/features/lock-branch.yml @@ -0,0 +1,7 @@ +# Reference: #8288 +# Documentation for locking branch with protected branch rule. +versions: + fpt: '*' + ghec: '*' + ghes: '>=3.8' + ghae: '>= 3.8'