DubStack
Getting Started

Quick Start

Get from zero to a working stacked PR flow fast.

Get from zero to a working stacked PR flow fast.

Prerequisites

  • git installed — Version control must be available on your system.
  • gh CLI authenticated:
    gh auth login
  • dub installed:
    # Homebrew
    brew tap wiseiodev/dubstack
    brew install dubstack
    
    # npm
    npm i -g dubstack

Optional: Enable AI Assistant

# Guided setup for Gemini, AI Gateway, or Amazon Bedrock
dub ai setup

# Reload your shell with the command DubStack prints
source ~/.zshrc

# Enable assistant for this repo
dub config ai-assistant on

# Pin the provider for this repository
dub config ai-provider bedrock

# Optional: enable AI defaults
dub config ai-defaults create on
dub config ai-defaults submit on
dub config ai-defaults flow on

# Ask a question
dub ai ask "Summarize this stack from trunk to current branch"

For Bedrock teams using AWS SSO or role-based auth, DubStack supports:

dub ai env \
  --bedrock-profile "bw-sso" \
  --bedrock-region "us-west-2" \
  --bedrock-model "us.anthropic.claude-sonnet-4-6"

dub ai setup and dub ai env both print the exact activation command to run after updating your shell profile.

If you want DubStack AI to follow your repository's formatting, also set up:

  • a PR template in .github/pull_request_template.md or .github/PULL_REQUEST_TEMPLATE/*.md
  • a commit template via git config commit.template .gitmessage

1. Start from Trunk

git checkout main
git pull

2. Create a Stack

Create three stacked branches with commits:

# Layer 1
dub create feat/auth-types -am "feat: add auth types"

# Layer 2 (parent: feat/auth-types)
dub create feat/auth-login -am "feat: add login flow"

# Layer 3 (parent: feat/auth-login)
dub create feat/auth-tests -am "test: add auth tests"

3. Inspect and Navigate

# View stack tree
dub log

# Interactive checkout
dub co

# Move around current path
dub up
dub down
dub top
dub bottom

4. Submit Stack PRs

# Submit stack
dub ss

# Preview only
dub ss --dry-run

# Open PR in browser
dub pr

Optional: Use the AI Flow

# Stage all, preview generated metadata, create, and submit
dub flow --ai -a

# Auto-approve after staging tracked files
dub flow -y -u

5. Respond to Feedback

When feedback lands on a middle branch:

dub co feat/auth-login

# Amend current commit
dub m -a -m "fix: address review feedback"

# Or create a new commit
dub m -c -a -m "fix: follow-up"

# Push updates
dub ss

6. Keep Stack in Sync

git checkout main
git pull
dub sync

7. Handle Restack Conflicts

dub restack
# Resolve conflicts in files
git add <resolved-files>
dub restack --continue

8. Merge in Safe Order

# Merge next safe PR in stack order
dub merge-next

# Run again for the next layer
dub merge-next

# If merges happened manually
dub post-merge

Fast Command List

CommandPurpose
dub create <name> -am "msg"Stage all + create + commit
dub mModify current branch commit(s)
dub logShow stack graph
dub coInteractive checkout
dub ssSubmit stack PRs
dub prOpen PR in browser
dub syncSync local state with remote
dub doctorRun stack health checks
dub readyRun pre-submit checklist
dub restackRebase stack onto updated parents
dub merge-nextMerge next safe PR + maintenance
dub continue / dub abortResume/cancel operations
dub undoUndo last create/restack
dub ai ask "..."Ask AI assistant
dub flow --ai -aRun the AI-assisted authoring flow

On this page