Delete branches with confidence. Removes local, remote, and tracking refs.
gx nuke deletes branches thoroughly: local branch, remote tracking ref, and remote branch in one operation. It supports glob patterns for batch deletion and has safety guards to prevent accidents.
$ gx nuke feature/old-auth feature/old-auth is NOT merged into main.Proceed with deletion? [y/N] yOK Deleted local branch feature/old-authOK Deleted remote tracking ref origin/feature/old-authOK Deleted remote branch origin/feature/old-auth
Cannot nuke the branch you are on. gx prints ERROR Cannot nuke '<branch>': it's the current branch. Switch first.
HEAD branch
Cannot nuke main/master. gx prints ERROR Cannot nuke '<branch>': it's the HEAD branch. Blocked for safety.
Unmerged warning
Branches not merged into the HEAD branch are flagged with a prominent warning
Stack children
If the branch has dependent branches in the stack, gx warns they will become orphaned
Confirmation
Always asks for confirmation (unless --yes), and always asks when unmerged branches are involved even with --yes
Deleting a branch that has children in the stack will orphan those children. They will appear in gx graph with the ! orphaned indicator. Use gx nuke --orphans later to clean them up, or use gx retarget to reparent them first.
gx nuke --orphans finds all branches in the stack config whose parent no longer exists and offers to delete them in batch. This is useful after merging and deleting parent branches.
Details
Glob patterns are resolved against all local branches