cub branch¶
Create and bind a git branch to an epic.
Synopsis¶
Description¶
The cub branch command creates a new git branch and binds it to an epic. This binding enables organized, trackable development where branches map to logical units of work.
When you create a branch binding:
- A new git branch is created (unless using
--bind-only) - The binding is recorded in
.beads/branches.yaml - Metadata is stored for later PR creation
- The epic becomes associated with this branch for
cub runandcub pr
Options¶
| Option | Description |
|---|---|
<epic-id> | Epic identifier to bind (required) |
--name <branch> | Custom branch name (default: feature/<epic-id>) |
--bind-only | Bind current branch without creating new one |
--base <branch> | Base branch to create from (default: current branch) |
Examples¶
Create Branch for Epic¶
# Create default-named branch
cub branch cub-vd6
# Output:
# Created branch: feature/cub-vd6
# Bound to epic: cub-vd6
Custom Branch Name¶
Bind Existing Branch¶
Create from Specific Base¶
Branch Naming Conventions¶
Default Naming¶
Without --name, branches are named:
Examples: - feature/cub-vd6 - feature/cub-abc123
Custom Naming¶
Use --name for descriptive names:
Session Branches¶
When using the auto-branch hook, session branches follow:
Examples: - cub/porcupine/20260111-114543 - cub/narwhal/20260111-120000
Binding Storage¶
Bindings are stored in .beads/branches.yaml:
bindings:
- epic_id: cub-vd6
branch: feature/cub-vd6
base_branch: main
created_at: 2026-01-11T11:45:43Z
status: active
pr_number: null
Binding Fields¶
| Field | Description |
|---|---|
epic_id | The epic this branch implements |
branch | Git branch name |
base_branch | Target branch for eventual PR |
created_at | When the binding was created |
status | active, merged, or closed |
pr_number | Associated PR number (if created) |
Workflow Integration¶
With cub run¶
The bound branch is used automatically:
With cub pr¶
PR creation uses binding information:
The binding provides: - Source branch - Target branch (from base_branch) - PR title (from epic title) - PR body (from completed tasks)
With Checkpoints¶
Branches can have associated checkpoints (review gates):
# Create a checkpoint for the branch
bd create "Review: feature complete" --type gate --parent cub-vd6
# List checkpoints
cub checkpoints --epic cub-vd6
# Approve to unblock further work
cub checkpoints approve <checkpoint-id>
Best Practices¶
One Epic per Branch¶
Each epic should have exactly one branch:
# Good: Each epic has its own branch
cub branch cub-001
cub branch cub-002
# Avoid: Multiple epics sharing a branch
Use Descriptive Names for Large Features¶
Keep Base Branch Updated¶
Before creating a new branch:
Troubleshooting¶
Branch Already Exists¶
Solution: Bind to existing branch instead:
Epic Already Bound¶
Check and rebind if needed:
Related Commands¶
cub branches- List and manage branch bindingscub pr- Create pull requestscub worktree- Parallel work with worktreescub merge- Merge completed work