Skip to content

Commit 8e592aa

Browse files
Doc updates for: Admins can allow specific users/teams to force push (GA) (#23934)
* Initial draft - likely needs layout fixes * Updated image * Apply suggestions from code review Co-authored-by: Ethan Palm <56270045+ethanpalm@users.noreply.github.com>
1 parent 1b2a293 commit 8e592aa

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

51.1 KB
Loading

content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,17 @@ You can only give push access to a protected branch to users, teams, or installe
159159

160160
### Allow force pushes
161161

162+
{% ifversion fpt or ghec %}
163+
By default, {% data variables.product.product_name %} blocks force pushes on all protected branches. When you enable force pushes to a protected branch, you can choose one of two groups who can force push:
164+
165+
1. Allow everyone with at least write permissions to the repository to force push to the branch, including those with admin permissions.
166+
1. Allow only specific people or teams to force push to the branch.
167+
168+
If someone force pushes to a branch, the force push may overwrite commits that other collaborators based their work on. People may have merge conflicts or corrupted pull requests.
169+
170+
{% else %}
162171
By default, {% data variables.product.product_name %} blocks force pushes on all protected branches. When you enable force pushes to a protected branch, anyone with at least write permissions to the repository can force push to the branch, including those with admin permissions. If someone force pushes to a branch, the force push may overwrite commits that other collaborators based their work on. People may have merge conflicts or corrupted pull requests.
172+
{% endif %}
163173

164174
Enabling force pushes will not override any other branch protection rules. For example, if a branch requires a linear commit history, you cannot force push merge commits to that branch.
165175

content/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/managing-a-branch-protection-rule.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,16 @@ When you create a branch rule, the branch you specify doesn't have to exist yet
104104
![Branch restriction checkbox](/assets/images/help/repository/restrict-branch.png)
105105
- Search for and select the people, teams, or apps who will have permission to push to the protected branch.
106106
![Branch restriction search](/assets/images/help/repository/restrict-branch-search.png)
107-
2. Optionally, under "Rules applied to everyone including administrators", select **Allow force pushes**. For more information about force pushes, see "[Allow force pushes](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches/#allow-force-pushes)."
107+
1. Optionally, under "Rules applied to everyone including administrators", select **Allow force pushes**.
108108
![Allow force pushes option](/assets/images/help/repository/allow-force-pushes.png)
109+
{% ifversion fpt or ghec %}
110+
Then, choose who can force push to the branch.
111+
- Select **Everyone** to allow everyone with at least write permissions to the repository to force push to the branch, including those with admin permissions.
112+
- Select **Specify who can force push** to allow only specific people or teams to force push to the branch. Then, search for and select those people or teams.
113+
![Screenshot of the options to specify who can force push](/assets/images/help/repository/allow-force-pushes-specify-who.png)
114+
{% endif %}
115+
116+
For more information about force pushes, see "[Allow force pushes](/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches/#allow-force-pushes)."
109117
1. Optionally, select **Allow deletions**.
110118
![Allow branch deletions option](/assets/images/help/repository/allow-branch-deletions.png)
111119
1. Click **Create**.

0 commit comments

Comments
 (0)