What protection blocks
On a protected branch, changes reach the branch only through a merge. Direct writes are blocked everywhere:- The chat. It stops before it writes and asks where to continue. See The chat and branches.
- The code editor. In the Frontend, saving is refused. You see Your changes were not saved, your edits stay in the editor, and you can save them in a new branch or switch to another one. In a service, the code is read-only.
- The visual editor and the theme editor. They show “This branch is protected: create a branch to edit” and “This branch is protected: create a branch to edit the theme”.
- Applying a pull request suggestion to a protected branch.
What protection does not block
- Reading, previewing, and sharing. You can open the branch and its preview, switch to it, and create share links from it. Right after a merge into a protected branch, sharing waits until the branch finishes updating.
- Creating branches from it. This is the normal way to continue: create a branch and work there.
- Publishing and deploying. These are separate actions that take a branch and a commit. See Previews, sharing, and publishing.
Make changes to a protected branch
- Create a branch from the protected one. Select New branch in the banner or in the branch menu.
- Make your changes on the new branch.
- Open a pull request into the protected branch. If the protected branch has no rules, you can also merge directly. See Pull requests.
Protect and unprotect a branch
Only Owners and Admins can protect and unprotect branches. Open Manage branches, find the branch, and open the row menu.- Select Protect branch and confirm with Protect. The dialog explains that changes reach the branch only through a merge and that visual edits and chat are blocked on it.
- Select Unprotect branch and confirm. The branch accepts direct changes again: visual edits, chat, and code saves.
Protection rules
Rules decide when a pull request can merge into a protected branch. Select Protection rules in the row menu of a protected branch. The dialog explains that nobody writes directly to a protected branch and that the rules decide when a pull request can merge.
Rules also apply to pull requests that are already open into that branch.
A branch with rules requires a pull request. Its row says requires a pull request, and merging into it directly is not offered. You see “branch requires review: merge it from a pull request.” A protected branch with No rules can be merged into directly. See Merging without a pull request.