Skip to main content

Issues and PRs > Head ref | Branch

Tom Williams avatar
Written by Tom Williams
Updated this week

Dataset: Issues & Pull Requests

Entity: Pull Requests, Issues

Field ID: head_ref_branch

Type: Text

Description: The branch of the head ref (source branch).

Source: App

Transformation logic: N/A

From:

Github (PRs, Issues)

head_ref_name

Gitlab (PRs, Issues)

source_branch

Bitbucket (PRs)

source.branch.name

Azure DevOps (PRs, Issues)

forkSource.name

JIRA (Issues)

N/A

ClickUp (Issues)

N/A

Trello (Issues)

N/A

Reporting Use Cases

The Head Ref Branch field, which identifies the source branch of a pull request, is invaluable for understanding your team's branching strategy and enforcing development conventions. It is most often used for filtering and for creating powerful custom formulas to categorize and analyze work.

  • Filtering for Compliance and Scoping: You can create reports that focus on specific development workflows or audit your team's branching habits.

    • Analyze Feature Development: Isolate all pull requests related to new features by using a regex filter like Head Ref Branch ~ "^feature/".

    • Enforce Naming Conventions: Find pull requests that don't follow your team's standards by creating a report where the branch name doesn't include a Jira ticket, for example: Head Ref Branch !~ "[A-Z]+-\d+".

    • Exclude Automated Branches: Filter out dependency updates by excluding branches created by bots, such as Head Ref Branch !~ "dependabot/".

  • Reporting on Development Patterns: While not commonly used as a primary dimension due to the high number of unique branch names, you can still use it to spot trends.

    • A list widget with Head Ref Branch as a dimension and COUNT() as the metric can help you identify branches that are generating an unusually high number of pull requests, which might indicate work that needs to be merged.

  • Custom Formulas for Data Extraction and Categorization: The most powerful use of this field is within custom formulas to extract structured data from your branch names.

    • Categorize Work by Branch Type: You can create a dimension that groups pull requests into categories like "Feature", "Bugfix", or "Hotfix" using a formula such as IF_MATCH(head_ref_branch, "^feat", "Feature", "^fix", "Bugfix", "Other"). This allows you to build high-level reports on the types of work your team is doing.

    • Extract Ticket Numbers: If your branch names include ticket identifiers, you can extract them to link PRs back to issues. A custom dimension with the formula REGEX_EXTRACT(head_ref_branch, "[A-Z]+-\\d+") will allow you to group all pull requests by the associated Jira ticket, providing a clear view of all the work related to a single issue.

Did this answer your question?