gt delete¶
Delete a branch from the stack.
Usage¶
Arguments¶
| Argument | Description |
|---|---|
[branch] |
Branch to delete (default: current branch) |
Options¶
| Option | Description |
|---|---|
-f, --force |
Force deletion even if branch has unmerged changes |
-D |
Shorthand for --force |
Examples¶
Delete Current Branch¶
Delete Specific Branch¶
Force Delete¶
Delete a branch with unmerged changes:
Behavior¶
- Checks if the branch has unmerged changes (unless
--force) - Re-parents any child branches to the deleted branch's parent
- Removes the branch from Stack's tracking
- Deletes the Git branch
- Switches to the parent branch if deleting current
Re-parenting¶
When you delete a branch that has children, the children are re-parented:
Before:
After:
Related Commands¶
gt create- Create a branchgt untrack- Stop tracking without deleting