PrStack

Basic Workflow

Learn the basic PrStack workflow

Basic Workflow

This guide walks you through a typical PrStack workflow.

Creating a Stack

Start by creating branches naturally as you would normally:

# Branch off main for feature A
jj new -m "Feature A"
jj bookmark create feature-a

# Make some changes and commit
# ...

# Branch off feature-a for feature B
jj new -m "Feature B"
jj bookmark create feature-b

# Make some changes and commit
# ...

Syncing Your Stack

When you're ready to create PRs, run sync:

prstack sync

This will:

  1. Fetch latest changes from remote
  2. Update your local trunk (main)
  3. Discover your stack: feature-b → feature-a → main
  4. Ask if you want to rebase on trunk (if trunk changed)
  5. Push your branches
  6. Offer to create missing PRs

Creating PRs

When prompted to create PRs, PrStack will:

  • Create a PR for feature-a targeting main
  • Create a PR for feature-b targeting feature-a

This ensures your PRs are properly chained.

Branching Off Mid-Stack

One of PrStack's strengths is adapting to changes:

# Switch back to feature-a
jj edit feature-a

# Create a new branch off feature-a
jj new -m "Feature C"
jj bookmark create feature-c

# Sync from this new context
prstack sync

# Discovers: feature-c → feature-a → main
# (feature-b is not in this stack)

Listing Your Stack

At any time, check your current stack:

prstack list --include-prs

Using the TUI

For a more interactive experience:

prstack

This launches the Terminal UI where you can:

  • View your stack visually
  • See diffs between branches
  • Create, merge, and manage PRs interactively

Tips

  • Run sync often: It's safe to run prstack sync frequently
  • Branch anywhere: Don't worry about planning your stack upfront
  • Let PrStack adapt: Switch branches and run sync again - it will figure out your new context
  • Use the TUI for exploration: When you want to understand your stack structure
  • Use CLI for speed: When you know exactly what you want to do

On this page