Skip to main content

gitq remove

Removes a leaf branch from a tracked stack.

Usage​

bash
gitq remove <branch> [--stack <name>]

Flags​

flagmeaning
--stack <name>Which tracked stack to remove from. Optional when the repo has exactly one; required otherwise. See Global flags.

Behavior​

Pure bookkeeping: removes one node from the resolved stack (src/core/stack-manager.ts:111-128). The git branch and its commits are untouched.

  • Refuses with usage help if <branch> is missing.
  • Refuses if the stack can't be resolved: see the --stack rule at Global flags.
  • Guarded by the stack lease (requireStackFree, src/cli/slots.ts:19-27): refuses if the stack has a running or parked cascade.
  • Refuses if <branch> is not a node in the stack: gitq: Branch "<branch>" not found in stack "<id>" (src/core/stack-manager.ts:112-115).
  • Refuses if the branch still has children: the error names the branch and how many child branches it has, then tells you to remove or re-parent them first (src/core/stack-manager.ts:117-122; paraphrased here, the literal source string uses an em dash this page does not reproduce). Re-parent the children onto a different branch, or remove them first, then retry.
  • Prints removed <branch> on success. Under --json, emits { stack: updatedStack }; this shape was not captured from a live run, but it is the exact type the source returns. See JSON output.

Exit codes​

  • 0: the branch was removed.
  • 1: any refusal above.

See Exit codes for the general contract.

See also​