Skip to main content
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.

Usage

Arguments

Flags

Examples

Safety Guards

gx nuke includes several safety measures:
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.

Merged vs Unmerged

  • Merged branches are deleted with git branch -d (safe delete)
  • Unmerged branches are deleted with git branch -D (force delete)
The merge status is checked against the HEAD branch using git branch --merged.

Orphan Mode

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.
  • Glob patterns are resolved against all local branches
  • Remote deletion uses git push origin --delete <branch>
  • Remote tracking refs are cleaned up with git branch -dr origin/<branch>
  • After deletion, the branch is removed from the stack config
  • When a branch is removed from the config, its children are also removed (they become orphaned)