Branches & protection rules
Create branches, choose the default branch, protect branches and tags from unwanted changes.
Branches#
The branch overview lists all branches with their last commit and how far ahead or behind the default branch they are. You can create branches (from a branch, tag or commit), rename and delete them. Set the default branch in the repository settings; new pull requests and the workflow overview target it.
The default branch, protected branches (which also cannot be renamed) and branches used by an open pull request cannot be deleted.
Branch protection#
Under Repository → Settings → Branches you add rules. A rule applies to a pattern: * matches within one path segment, ** across segments – e.g. main, release/* or feature/**.
| Option | Effect |
|---|---|
| Require pull request (no direct pushes) | Changes reach matching branches only through a pull request. |
| Allow force pushes | Without this option force pushes are rejected. |
| Allow deletion | Without this option the branch cannot be deleted. |
| Push allowlist | Comma-separated usernames that may still push directly. |
A server-side hook checks the rules on every Git push – over HTTPS or SSH, from the web editor, by upload or through Claude. When in doubt it rejects. Merging a pull request is not blocked by the rules; that is what they are for.
Tag protection#
For protected tags (patterns such as v*): existing matching tags can no longer be moved or deleted. New tags can still be created. Published versions stay unchanged.
A proven combination: main with “Require pull request” and no force push, tags v* protected.
Was this page helpful?