Anyone with admin permissions to a repository can enable force pushes.
By default, force pushes are blocked 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.
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.
You can automatically enforce protected branch settings for some or all branches in your repository. Para obter mais informações, consulte "Configurar branches protegidos".
- No GitHub, navegue até a página principal do repositório.
- Under your repository name, click Settings.
- In the left menu, click Branches.
- Next to "Branch protection rules", click Add rule.
- Under "Branch name pattern", type the branch name or pattern you want to protect.
- Under "Rules applied to everyone including administrators", select Allow force pushes.
- Click Create.