Anyone with admin permissions to a repository can enable branch deletions.
By default, you cannot delete a protected branch. When you enable deletion to a protected branch, anyone with at least write permissions to the repository can delete the branch, including those with admin permissions.
You can automatically enforce protected branch settings for some or all branches in your repository. For more information, see "Configuring protected branches."
- On GitHub, navigate to the main page of the repository.
- 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 deletions.
- Click Create.