Branch patterns
With the Repository Settings API, you can use pattern syntax to define branches. As a result, you can apply conditions and configurations to all the branches that match the pattern.
Wild cards
A pattern can contain any number of wild cards. The following wild cards are accepted:
Wild card | Description |
---|---|
? | Matches one character. Doesn’t match path separators. |
* | Matches zero or more characters. Doesn’t match path separators. |
** | Matches zero or more path segments. |
Note that if a pattern ends with /
, then **
is added automatically. For example, new-feature/
matches all the branches that contain a new-feature
path segment.
Branch names
Note that there's a difference between using a branch name without a prefix (for example master
) and a fully qualified branch name (for example refs/heads/master
). A pattern that doesn't specify a fully qualified name might match multiple branches. See examples for details.
Examples
See the following examples of branch patterns:
Pattern | Result |
---|---|
* | Matches every branch. |
feature-* | Matches every branch whose name starts with
|
hotfix-*/ | Matches every branch whose name contains a path segment that starts with
For example:
|
refs/heads/hotfix-* | Matches every branch whose fully qualified name starts with
|
?.? | Matches every branch whose name consists of two characters separated by
For example:
|
Was this page helpful?