Skip to main content
Shortcake

Turn big changes into pull requests reviewers can follow.

Shortcake helps you build a feature as a stack of small, review-sized branches, see the order at a glance, and submit matching GitHub PRs from your terminal.

Python 3.14+ License: MIT Sponsor


The whole stack is reconstructed from your commits. Each branch records its parent in a git trailer — no state files, no metadata branch, no daemon. Rebase, push, checkout, and branch with the tools you already use; the stack travels with your Git history.

feat: add login form

Shortcake-Parent: main

That one marker is why Shortcake can recover the order after rebases, checkouts, and pushes without a separate state file to keep in sync.

Why stacked PRs?

Big pull requests are hard to review. Stacked branches let you send a large change in the order it should be read — foundation first, follow-ups after — so each PR stays focused on one idea instead of the whole feature. Shortcake keeps that order visible and submits PRs with bases that match it, so reviewers always know what builds on what.

Install

uv tool install shortcake

Requires Python 3.14+. The install exposes both shortcake and the short alias sc.

Other ways to install
# pipx
pipx install shortcake

Quick start

Build a two-branch stack, look at it, and open the PRs — start to finish.

1. Create a branch from your staged changes. sc create commits what's staged and records main as the parent.

$ echo "def login(): ..." > login.py && git add login.py
$ sc create -m "Add login form"
Created branch 'add-login-form' from 'main'

2. Stack the next change on top. Run create again — the new branch's parent is the one you're on.

$ echo "def reset(): ..." > reset.py && git add reset.py
$ sc create -m "Add password reset"
Created branch 'add-password-reset' from 'add-login-form'

3. See the stack with sc ls:

$ sc ls
◉ add-password-reset (current)
│
◯ add-login-form
│
◯ main

4. Submit through the current diff to GitHub. sc submit pushes the current branch and its downstack ancestors, opening or updating their PRs in dependency order. Use sc submit --stack to include upstack branches too. In an interactive terminal, sc submit offers to expand the submission to the whole stack when there are branches above the current one. Add --draft/-d for drafts, --dry-run/-n to preview first, or --stealth to push without creating or updating PRs.

$ sc submit --stack
Submit plan:

  ◯ main (base)
  │
  ● add-login-form — create PR
  │
  ◉ add-password-reset (current) — create PR

● 2 selected

Pushing 'add-login-form'...
  Creating PR for 'add-login-form'...
  Created PR #1: https://github.com/you/repo/pull/1
Pushing 'add-password-reset'...
  Creating PR for 'add-password-reset'...
  Created PR #2: https://github.com/you/repo/pull/2

Created 2 PR(s)

For a linear stack, Shortcake registers the PR sequence with GitHub's native stack API, so GitHub renders the stack header and enables stack-wide merge and rebase actions. sc ls shows the PR numbers and native positions:

$ sc ls --refresh
◉ add-password-reset #2 stack #1 2/2 (current)
│
◯ add-login-form #1 stack #1 1/2
│
◯ main

sc submit normally needs a GitHub token (from gh auth login, or GH_TOKEN/GITHUB_TOKEN) and an origin remote pointing at GitHub. sc submit --stealth only pushes branches, so it does not need the GitHub API token. Submit restacks branches before pushing and uses --force-with-lease so it won't clobber others' work. GitHub native stacks require a linear sequence of branches in one repository. Non-linear Shortcake trees, repositories where stacked pull requests are not available yet, and stacks outside GitHub's limits keep the managed PR-body map as a compatibility fallback.

That's the core loop: create → ls → submit. The rest of the CLI is there when you need to move, split, restack, or repair branches.

How it works

The stack is rebuilt entirely from the Shortcake-Parent trailer in each branch's first commit. ls/log walk parent → children, and restack rebases descendants whenever a parent moves. Because the relationship lives in the commit, the stack survives rebasing, pushing, and branching with any Git tooling — there's nothing else to keep in sync.

Already started a branch the normal way? sc adopt brings an existing branch into a stack instead of recreating it.

The commit trailers remain Shortcake's local source of truth. On submit, GitHub's native stack resource is the remote representation: Shortcake creates it, appends new top PRs, and safely recreates it for whole-stack reorders/removals. A scoped submit will not dismantle a stack containing unselected PRs. Migrating an existing PR-body stack is atomic too: when a scoped submit leaves open legacy layers out, Shortcake keeps the body map and points to sc submit --stack to migrate the whole stack.

To bring a stack created on GitHub onto a new machine, run sc checkout <PR>. When that PR belongs to a native stack, Shortcake fetches every open branch, preserves correctly tracked local work, and writes the matching trailers before checking out the requested branch. It will not overwrite a divergent branch that needs re-parenting. If GitHub rebases a stack server-side, run sc pull before continuing local work; remote branch refs win by default.

Commands

Build the stack create (new tracked branch; --before/--after to insert) · adopt (track an existing branch)
Edit the stack modify · fold · reorder · move · split (move files into a new stacked branch)
Restack restack (rebase children when a parent changes) · continue · abort (resume/abandon after a conflict)
Navigate & inspect up · down · top · bottom · checkout (alias co) · ls · log
GitHub & remote submit (open/update and register native stacks) · sync · pull · review
Web UI ui

Run sc <command> --help for the options on any command.

Review the stack in your browser

sc ui

Opens a local, GitHub-style view of every branch diff — file tree, inline comments, and AI review — reading straight from your repo. Nothing leaves your machine.

You can also review a branch from the terminal with sc review, which runs the change through an installed AI CLI (claude or codex).

Working with coding agents

Shortcake is built to be driven by agents as well as humans: every core command takes --json (exactly one JSON document on stdout — {"data": ...} or {"error": {"code", "message", "hint"}}), sc sync never blocks on prompts in non-interactive shells, and pre-commit formatter failures self-heal.

Shortcake ships a workflow skill that teaches an agent the stacked-PR model. Install it for Claude Code with:

mkdir -p .claude/skills/shortcake-stacked-prs
sc skill --print shortcake-stacked-prs > .claude/skills/shortcake-stacked-prs/SKILL.md

Or paste this into your project's CLAUDE.md / agent instructions:

This repo uses shortcake (`sc`) for stacked PRs. Read the workflow first:
run `sc skill --print shortcake-stacked-prs`. Key points: use `sc ls --json`
to read the stack, `sc create -m` / `sc modify` / `sc split` to shape it,
`sc restack` + `sc continue` for rebases, and `sc submit` for PRs. Pass
`--json` to any of these for machine-readable output.

Development

# Tests + coverage (must stay at 100%)
uv run pytest tests/ -v --cov=src/shortcake --cov-report=term
uv run coverage report --fail-under=100

# CLI end-to-end tests (executable markdown docs in e2e/docs/)
uv run python e2e/markdown_runner.py

# Browser e2e for the web UI (one-time: uv run playwright install --with-deps chromium)
uv run pytest tests/e2e/ -v

# Lint, format, and type-check
uv run --group linting ruff check src/ tests/
uv run --group linting ruff format --check src/ tests/
uv run --group typing ty check src/

See CLAUDE.md for the project layout and conventions.

License

MIT © Patrick Arminio. If Shortcake is useful to you, consider sponsoring. 🍰

Metadata

Release files for shortcake 1.7.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shortcake 1.7.3
File Size Uploaded
shortcake-1.7.3.tar.gz 286.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for shortcake 1.7.3
File Interpreter ABI Platform
shortcake-1.7.3-py3-none-any.whl Python 3 none any Details

Total release size: 603.4 kB

Release files / shortcake-1.7.3.tar.gz

Download URL shortcake-1.7.3.tar.gz
Size 286.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4e2814ca17d947acd83d483df0bbe3fbd02b4d1fe77369ceb01791e562c77e9f
BLAKE2b-256 checksum
How to use checksums
4e42ffa37fcc4b4c0c16a73b35554e81a99fc4b604a2fd227bd7952e69cc709d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / shortcake-1.7.3-py3-none-any.whl

Download URL shortcake-1.7.3-py3-none-any.whl
Size 317.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36083166dfb6a898edec8a460e0dcc3772b92b756a6f4c45dd0bb2f6ba9b1e1a
BLAKE2b-256 checksum
How to use checksums
59741ecef9d7f59c437ef45db5cd65b30890c5fd175d11ad830b144bfa66ece7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.16 {"installer":{"name":"uv","version":"0.12.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

1.7.7

2 release files

1.7.6

2 release files

1.7.5

2 release files

1.7.4

2 release files

This release

1.7.3 This release

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.6

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page