# Deleting Neon branches safely

## The trap
"Delete the old preview branches" sounds like cleanup until the delete fails on a branch with children, or succeeds on a branch something still points to. Both failure modes come from not checking dependents first.

## The rule
- Deleting a branch is permanent: databases, roles, and the branch's compute go with it.
- You cannot delete a branch that has child branches; delete children first, bottom-up.
- Old branches pin history and grow storage, so deletion is also cost control, not just tidiness.

## Checklist
1. List child branches of the target; delete them first.
2. Grep your configs and secrets for the branch's connection string or endpoint ID; repoint or remove references.
3. Confirm no active compute usage in the Console monitoring for that branch.
4. Then delete, via Console, CLI, or API.
5. For recurring cleanup, prefer branch expiration (1 hour / 1 day / 7 days) over manual deletion runs.