Skip to main content
A stack is a chain of pull requests where each one builds on the one below it: the bottom pull request targets the default branch, and each pull request above it targets the branch of the one below. Flowmaps recognizes stacks from the pull requests themselves, so stacks made by hand count the same as stacks made with stacking tools. A single pull request into the default branch is a stack of one and behaves as described in PR previews.

Preview each PR (the default)

Each pull request in the stack gets its own preview of its own change:
  • The bottom pull request is compared with the default branch, as usual.
  • Each pull request above it is compared with the pull request below it. Its “before” is the “after” of the preview below, so a flow the pull request below already worked out isn’t worked out again.
  • Previews run bottom up. A pull request’s preview waits for the one below it to finish.
The check and comment on an upper pull request open with one line saying what it was compared with, for example: “Compared with #41, the PR below it in this stack.” If the pull request below has no finished preview (it’s on request and nobody asked, it’s a draft, or its preview stopped), the upper pull request is compared with the default branch instead, and says so: “Compared with main, so this includes #41 and #42.” When you push to a lower pull request and rebase the ones above, each is previewed again. Flows the lower change doesn’t touch are carried forward with no credits, so a rebase costs only what the change touches.

Preview the top only

An owner or admin can switch the workspace to one preview per stack in Settings › PR previews, under Stacked PRs:
  • Preview each PR. Every PR in a stack shows its own changes, compared with the PR below it.
  • Preview the top only. One preview of the whole stack, compared with the default branch. It uses fewer credits when several pull requests in a stack change the same flows.
With Preview the top only, the pull requests below the top get a neutral check titled “Previewed with its stack, on #43” that links to the top’s preview, with the summary “This workspace previews a stack once, at its top. Press Preview to see this PR’s own changes.” Pressing Preview on one of them previews that pull request on its own.

Which setting to choose

If your stacks usually change the same shared code at each level, Preview the top only costs less. If they touch separate areas, both cost the same and Preview each PR gives each reviewer their own view. Other settings still apply to each pull request in a stack: previews on request, Review every push, and drafts.

Merging a stack

  • A merged stack shows as its pull requests. On Changes and in each flow’s history, the merge is credited to the pull requests it came from, not shown as a direct push.
  • The merge reuses the stack’s previews. When the merged code matches a previewed state of the stack, the merge takes the previewed flows with no further credits.
  • Merging part of a stack is fine. After the bottom pull request merges, GitHub points the next one at the default branch, and it becomes an ordinary pull request. Because its base changed, it’s previewed again against the default branch: on its own if previews are automatic, or when someone asks if they’re on request.
Stacks across forks or across repos aren’t recognized as stacks.

Next steps

PR previews

What a preview shows and how to request one.

Merges

How flows update when a pull request merges.