Protect a Branch
By default, any project member can rename or delete a repository branch, and push or merge another branch into it. The project owner can protect a branch from these actions by setting restrictions on the branch:
Glob Pattern Reference for Matching Branch, Job, and Pipeline Names
Glob syntax can be used to specify pattern-matching behavior. A glob pattern is specified as a string and is matched against a branch, job, or pipeline name. These wildcard characters can be used in glob patterns:
Wildcard | Description |
---|---|
* | Matches zero or more characters of a name without crossing directory boundaries. |
** | Matches zero or more characters of a name crossing directory boundaries. |
? | Matches exactly one character. |
[] | A bracket expression that matches a single character out
of a set of characters or, when the hyphen character is used, a range of
characters.
For example, [abc] matches "a", "b", or "c". [a-z] specifies a range that matches from "a" to "z", inclusive. Forms can be mixed, so [abce-g] matches "a", "b", "c", "e", "f" or "g". If the character after the left bracket is an exclamation mark (!), it indicates negation, so the expression [!a-c] matches any character except "a", "b", or "c". Within a bracket expression, the *, ? and \ characters match themselves. The (-) character matches itself if it is either the first character within the brackets or the first character after the !, if negating. |
{} | Represents a group of subpatterns. The group matches if any subpattern in the group matches. Uses a comma (",") to separate subpatterns. Groups can't be nested. |
\ | Escapes characters that would otherwise be interpreted
as special characters.
For example, the expression "\\" matches a single backslash and "\{" matches a left brace. |
The forward slash (/) represents the directory separator on all platforms.