> ## Documentation Index
> Fetch the complete documentation index at: https://bloodhound.specterops.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GH_Branch

> A named reference in a repository representing a line of development

<img noZoom src="https://mintcdn.com/specterops/tTIczgde9H07oLXf/assets/enterprise-AND-community-edition-pill-tag.svg?fit=max&auto=format&n=tTIczgde9H07oLXf&q=85&s=ad49a576589f4d2a8081df77d07fdf56" alt="Applies to BloodHound Enterprise and CE" width="482" height="45" data-path="assets/enterprise-AND-community-edition-pill-tag.svg" />

## General Information

Represents a Git branch within a repository. Branch nodes capture basic branch information and whether the branch is protected. Protection rule details are stored in separate [GH\_BranchProtectionRule](/opengraph/extensions/github/nodes/gh_branchprotectionrule) nodes, linked via [GH\_ProtectedBy](/opengraph/extensions/github/edges/gh_protectedby) edges.

## Properties

| Property             | Type       | Description                                                                                             |
| -------------------- | ---------- | ------------------------------------------------------------------------------------------------------- |
| `name`               | `string`   | The node name used for matching and display.                                                            |
| `displayname`        | `string`   | The human-readable display name.                                                                        |
| `environmentid`      | `string`   | The identifier of the GitHub environment where this node was collected.                                 |
| `last_seen`          | `datetime` | The timestamp when this node was last observed during collection.                                       |
| `node_id`            | `string`   | The stable identifier used as the OpenGraph node ID; this is the native GitHub node ID where available. |
| `collected`          | `boolean`  | Collected/generated by OpenHound.                                                                       |
| `short_name`         | `string`   | The branch reference name (e.g., `main`).                                                               |
| `commit_hash`        | `string`   | The commit hash property.                                                                               |
| `protected`          | `boolean`  | Whether the branch has a protection rule.                                                               |
| `repository_name`    | `string`   | The repository name property.                                                                           |
| `repository_id`      | `string`   | The repository id property.                                                                             |
| `environment_name`   | `string`   | The name of the environment (GitHub organization).                                                      |
| `query_branch_write` | `string`   | Query for branch write.                                                                                 |

## Diagram

```mermaid theme={null}
graph LR
    n0["GH_Branch"]
    n1["GH_Environment"]
    n2["GH_EnvironmentBranchPolicy"]
    n3["GH_OrgRunnerGroup"]
    n4["GH_BranchProtectionRule"]
    n5["GH_RepoRole"]
    n6["GH_Repository"]
    n7["GH_Team"]
    n8["GH_User"]
    n0 -->|GH_CanDeployToEnvironment| n1
    n0 -.->|GH_MatchesEnvironmentPolicy| n2
    n0 -->|GH_CanUseRunner| n3
    n4 -.->|GH_ProtectedBy| n0
    n5 -.->|GH_CanEditProtection| n0
    n5 -->|GH_CanPwnRequest| n0
    n5 -.->|GH_CanWriteBranch| n0
    n6 -.->|GH_Contains| n0
    n7 -.->|GH_CanWriteBranch| n0
    n8 -.->|GH_CanWriteBranch| n0
```

## Edges

<Note>
  The tables below list edges defined by the GitHub extension only. Additional edges to or from this node may be created by other extensions.
</Note>

```mermaid theme={null}
flowchart LR

    GH_Branch["GH_Branch"]
    GH_BranchProtectionRule["GH_BranchProtectionRule"]
    GH_Environment["GH_Environment"]
    GH_EnvironmentBranchPolicy["GH_EnvironmentBranchPolicy"]
    GH_OrgRunnerGroup["GH_OrgRunnerGroup"]
    GH_RepoRole["GH_RepoRole"]
    GH_Repository["GH_Repository"]
    GH_Team["GH_Team"]
    GH_User["GH_User"]
    GH_Branch -- GH_CanDeployToEnvironment --> GH_Environment
    GH_Branch -- GH_CanUseRunner --> GH_OrgRunnerGroup
    GH_Branch -- GH_MatchesEnvironmentPolicy --> GH_EnvironmentBranchPolicy
    GH_BranchProtectionRule -- GH_ProtectedBy --> GH_Branch
    GH_RepoRole -- GH_CanEditProtection --> GH_Branch
    GH_RepoRole -- GH_CanPwnRequest --> GH_Branch
    GH_RepoRole -- GH_CanWriteBranch --> GH_Branch
    GH_Repository -- GH_Contains --> GH_Branch
    GH_Team -- GH_CanWriteBranch --> GH_Branch
    GH_User -- GH_CanWriteBranch --> GH_Branch
```

### Inbound Edges

| Edge Type                                                                        | Source Node Types                                                                                                                                                              | Traversable |
| -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- |
| [GH\_CanEditProtection](/opengraph/extensions/github/edges/gh_caneditprotection) | [GH\_RepoRole](/opengraph/extensions/github/nodes/gh_reporole)                                                                                                                 | ✅           |
| [GH\_CanPwnRequest](/opengraph/extensions/github/edges/gh_canpwnrequest)         | [GH\_RepoRole](/opengraph/extensions/github/nodes/gh_reporole)                                                                                                                 | ✅           |
| [GH\_CanWriteBranch](/opengraph/extensions/github/edges/gh_canwritebranch)       | [GH\_RepoRole](/opengraph/extensions/github/nodes/gh_reporole), [GH\_Team](/opengraph/extensions/github/nodes/gh_team), [GH\_User](/opengraph/extensions/github/nodes/gh_user) | ✅           |
| [GH\_Contains](/opengraph/extensions/github/edges/gh_contains)                   | [GH\_Repository](/opengraph/extensions/github/nodes/gh_repository)                                                                                                             | ❌           |
| [GH\_ProtectedBy](/opengraph/extensions/github/edges/gh_protectedby)             | [GH\_BranchProtectionRule](/opengraph/extensions/github/nodes/gh_branchprotectionrule)                                                                                         | ❌           |

### Outbound Edges

| Edge Type                                                                                      | Destination Node Types                                                                       | Traversable |
| ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ----------- |
| [GH\_CanDeployToEnvironment](/opengraph/extensions/github/edges/gh_candeploytoenvironment)     | [GH\_Environment](/opengraph/extensions/github/nodes/gh_environment)                         | ✅           |
| [GH\_CanUseRunner](/opengraph/extensions/github/edges/gh_canuserunner)                         | [GH\_OrgRunnerGroup](/opengraph/extensions/github/nodes/gh_orgrunnergroup)                   | ✅           |
| [GH\_MatchesEnvironmentPolicy](/opengraph/extensions/github/edges/gh_matchesenvironmentpolicy) | [GH\_EnvironmentBranchPolicy](/opengraph/extensions/github/nodes/gh_environmentbranchpolicy) | ❌           |

## Properties

| Property             | Type          | Description                                        |
| -------------------- | ------------- | -------------------------------------------------- |
| `name`               | `str`         | -                                                  |
| `displayname`        | `str`         | -                                                  |
| `environmentid`      | `str`         | -                                                  |
| `last_seen`          | `datetime`    | -                                                  |
| `node_id`            | `str`         | -                                                  |
| `collected`          | `bool`        | Collected/generated by OpenHound                   |
| `short_name`         | `str \| None` | The branch reference name (e.g., `main`).          |
| `commit_hash`        | `str \| None` | The commit hash property.                          |
| `protected`          | `bool`        | Whether the branch has a protection rule.          |
| `repository_name`    | `str \| None` | The repository name property.                      |
| `repository_id`      | `str \| None` | The repository id property.                        |
| `environment_name`   | `str \| None` | The name of the environment (GitHub organization). |
| `query_branch_write` | `str \| None` | Query for branch write.                            |
