Large features rarely fit in a single pull request. Splitting work into dependent PRs keeps code reviews focused, but maintaining the stack is painful — rebasing cascades when upstream changes and PR bases drift after merges. sdf eliminates that manual work.
Stacked Diffs Flow (sdf) is a lightweight CLI tool that orchestrates git, gh, and claude to manage chains of dependent pull requests. It tracks stack topology locally, cascade-rebases downstream branches when PRs merge, and uses Claude to resolve conflicts automatically.
Philosophy
sdf follows a local-first approach — all stack metadata lives in a .sdf/ directory that is never committed. PR descriptions on GitHub serve as the shared source of truth, so any teammate can reconstruct the stack state on their machine with sdf fetch. The tool works out of the box with sensible defaults and requires zero configuration to get started.
What you can do with it
- Create stacks —
sdf newstarts a stack and its first branch;sdf branchadds layers on top - Open PRs —
sdf prcreates a GitHub PR with the correct base branch already set - Sync after merges —
sdf syncdetects merged PRs, cascade-rebases all downstream branches, force-pushes, and updates PR bases on GitHub in one command - AI conflict resolution — when a rebase hits conflicts during sync, Claude receives the PR context, upstream diff, and conflicted files, then resolves them in-place
- Manage multiple stacks — independent stacks can coexist in the same repo, each with its own base branch
- Move commits —
sdf movepromotes commits from the current branch to its parent when work lands in the wrong layer - Machine-readable output — commands support
--jsonfor scripting and CI/CD integration