Commands
dub create
Create a branch stacked on top of the current branch, with optional staging and commit.
Usage
# Branch only
dub create feat/my-change
# Create + commit staged changes
dub create feat/my-change -m "feat: ..."
# Stage all + create + commit
dub create feat/my-change -am "feat: ..."
# Stage tracked-file updates + create + commit
dub create feat/my-change -um "feat: ..."
# Interactive hunk staging + create + commit
dub create feat/my-change -pm "feat: ..."
# AI-generate branch + conventional commit from staged changes
dub create --ai
# Override repo AI defaults for one command
dub create --no-ai feat/my-change
# Stage all, then AI-generate branch + commit
dub create -aiFlags
| Flag | Description |
|---|---|
-m, --message <message> | Commit message |
-a, --all | Stage all changes before commit (requires -m or --ai) |
-u, --update | Stage tracked-file updates before commit (requires -m or --ai) |
-p, --patch | Select hunks interactively before commit (requires -m or --ai) |
-i, --ai | AI-generate branch + conventional commit from staged changes |
--no-ai | Disable AI generation for this invocation, even if repo defaults enable it |
AI Mode
When using --ai or -ai, DubStack analyzes your staged changes and generates a descriptive branch name and conventional commit message. Configure the provider with dub ai setup or dub ai env, then enable the assistant with dub config ai-assistant on.
If your repository enables AI create defaults, --no-ai lets you force manual mode for a single invocation.
If your repository configures a commit message template with git config commit.template, DubStack includes that template when generating AI commit messages so the body follows the repo's expected sections and formatting.
# AI with explicit staging
dub create --ai
# Stage all + AI (shorthand)
dub create -ai
# Example commit template setup
cat <<'EOF' > .gitmessage
feat(scope): summary
## Testing
- [ ] added coverage
EOF
git config commit.template .gitmessageNotes
dub createauto-initializes DubStack state if needed.- The new branch is always stacked on the current branch.
- Use
dub undoto revert the most recent create (multi-level via the 20-entry ring buffer;dub redoreplays).