Clean up temporary branches
Remove a temporary development or preview branch after its work is complete.
Neon · Command
Permanently deletes a Neon project branch by ID or name. Specify --project-id unless a default project has been set with neon set-context.
The command permanently removes the selected branch using either its ID or name. Supply the project explicitly unless a default project has been configured with neon set-context; the operation also removes the branch’s associated databases, roles, and compute.
neon branches delete <id|name> [options]| Name | Type | Description |
|---|---|---|
id|name | string | Branch ID or name to delete. |
--project-id | string | Project ID containing the branch; optional when a default project context is configured. |
On success, the command displays the deleted branch's name, ID, current state, and creation time.
--project-id is an optional string identifying the target project.neon branches delete br-rough-sky-123456 --project-id my-project-idDeletes the named branch from the specified Neon project.
Remove a temporary development or preview branch after its work is complete.
Delete a parent branch after first removing all of its child branches.
Run controlled cleanup in automation with an explicit project and branch ID.
The command is neon branches delete <id|name> [options]. It accepts either a branch identifier or branch name, and --project-id selects the target project when needed.
Follow-up: What prevents deleting a branch? A root or default branch, a branch with children, or the last remaining branch in a project cannot be deleted.
Deleting a branch is permanent and also removes the databases, roles, and compute associated with that branch. Existing client connections can therefore be disrupted while compute endpoints enter an idle state.
Follow-up: What cleanup is required first? Delete child branches before their parent, because a branch with children is not eligible for deletion.
Use --project-id to identify the project unless neon set-context has configured a default project. The command can address the branch by either its name or ID.
Follow-up: How would you avoid an ambiguous target? Use the branch ID together with an explicit project ID, especially in automation.
neon set-contextneon branches listneon branches createDelete branch