Skip to main content

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 cardDescription
?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:

PatternResult
*Matches every branch.
feature-*

Matches every branch whose name starts with feature-, even in a namespace.
For example:

  • refs/heads/feature-1234
  • refs/heads/stable/feature-new
hotfix-*/

Matches every branch whose name contains a path segment that starts with hotfix-, even in a namespace.


For example:

  • refs/heads/hotifx-1234
  • refs/heads/stable/hotfix-new/user
refs/heads/hotfix-*

Matches every branch whose fully qualified name starts with refs/heads/hotfix-.
For example:

  • refs/heads/hotifx-1234
  • refs/heads/hotfix-new
?.?

Matches every branch whose name consists of two characters separated by .


For example:

  • refs/heads/2.1
  • refs/heads/stable/2.X
Legal and support information

Published: December 3, 2024 at 9:55 AM

© 2024 Guidewire Software, Inc.