Code Storage now has a first-class branch delete API.
You can delete a branch without shelling out to git push origin --delete, which is useful for
cleanup jobs, preview environments, and agent workflows that create short-lived branches
programmatically.
await repo.deleteBranch({
name: 'feature/cleanup',
});await repo.delete_branch(
name="feature/cleanup",
)deletedBranch, err := repo.DeleteBranch(ctx, storage.DeleteBranchOptions{
Name: "feature/cleanup",
})The API sends a normal Git ref deletion through the same push pipeline used for repository writes, so branch deletion follows the same storage, replication, and sync paths as other ref updates. GitHub-connected repositories also schedule a background sync after the branch is deleted.
The default branch cannot be deleted through this endpoint, and branch names are validated before
the delete is attempted. On success, the response includes the deleted branch name and a
branch deleted message.
TypeScript, Python, and Go SDKs all support deleteBranch.