Skip to content


Subscribe to all “gitrepositoriesbranches” posts via RSS or follow GitHub Changelog on Twitter to stay updated on everything we ship.

~ cd github-changelog
~/github-changelog|main git log main
showing all changes successfully

Now, admins can block creation of branches that match a configured name pattern. For example, if a repository's default branch is renamed from master to main, admins can prevent any subsequent creation or push of the master branch so that only the new branch name is used.

Previously, admins could use branch protection rules to restrict who could push to existing branches, but they couldn't block the creation of those branches. This is now possible using a branch protection setting named Restrict pushes that create matching branches. To use the setting, create a new branch protection rule with a name pattern that matches the branch name you want to block (e.g. master or not-allowed*). Then, enable the settings Restrict who can push to matching branches and Restrict pushes that create matching branches, as shown here:

An image showing the two branch protection settings to enable for restricting pushes that create matching branches

For more information, visit About protected branches in the GitHub documentation.

We appreciate feedback on this and other topics in GitHub's public feedback discussions.

See more