Skip to main content
POST
Discard branch changes

Authorizations

Authorization
string
header
required

Personal access token, sent as Authorization: Bearer <token>. Each operation lists the permission it needs: read_only or full_access. A full-access token can call every operation. A read-only token can call only the operations that list read_only; anything else returns 403 read_only_credential_route_not_allowed.

Path Parameters

app_id
string
required

ID of the app.

Query Parameters

branch_id
string

ID of the branch to work on, as returned by List branches. Omit it to work on the app's main branch.

Response

The branch's git state after discarding.

current_branch
string
required

Branch checked out in the branch's environment, or HEAD when none is checked out.

Example:

"feature/checkout"

default_branch
string
required

The repository's default branch on GitHub.

Example:

"main"

base_branch
string
required

The branch the app was imported from. Pull requests merge into it.

Example:

"main"

head
string | null
required

SHA of the latest commit, or null when the branch has no commits.

Example:

"9fceb02d0ae598e95dc970b74767f19372d61af8"

head_committed_at
string<date-time> | null
required

When the latest commit was made, as an ISO 8601 UTC timestamp, or null.

Example:

"2026-10-28T09:15:00Z"

dirty
boolean
required

Whether there are uncommitted changes.

Example:

true

dirty_files
string[]
required

Paths of the first 20 files with uncommitted changes. A renamed file reads old -> new.

Example:
ahead
integer | null
required

Commits not pushed to GitHub yet, or null when the branch isn't on GitHub.

Example:

1

behind
integer | null
required

Commits on GitHub the environment doesn't have yet, as of its last fetch, or null when the branch isn't on GitHub.

Example:

0

merge_in_progress
boolean
required

Whether a merge is under way, for example while conflicts are resolved.

Example:

false