Delete Branch
deprecated
Delete a branch from the repository. The default branch is protected and cannot be deleted through this endpoint.
JWT claims
Required scopes: git:write
Requires per repo scope: Yes
Deprecated: Use /api/repos/{repo_name}/branches instead.
DELETE
Delete Branch
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Delete a branch by name. The server resolves the current branch tip before deleting, so the caller does not need the branch SHA.
Response
Branch deletion result.
Previous
Create BranchCreate a new branch from an existing branch or ref. This is useful for agent workflows, ephemeral previews, or server-side automation where you do not want to clone the repo first.
#### JWT claims
Required scopes: `git:write`
Requires per repo scope: Yes
Deprecated: Use `/api/repos/{repo_name}/branches/create` instead.
Next
Delete Branch