Skip to content

Commit 1202625

Browse files
committed
stacking recommendation banner
1 parent 5867a30 commit 1202625

5 files changed

Lines changed: 26 additions & 2 deletions

File tree

83.2 KB
Loading
144 KB
Loading
121 KB
Loading

docs/src/content/docs/faq.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ gh stack submit
2525

2626
You can also create stacks entirely from the GitHub UI — create the first PR normally, then when creating subsequent PRs, select the option to add them to a stack. See [Creating a Stack from the UI](/gh-stack/guides/ui/#creating-a-stack-from-the-ui) for a walkthrough.
2727

28+
If you already have open PRs whose branches line up, GitHub will detect and suggest turning them into a stack. See [Turning Existing PRs into a Stack](/gh-stack/guides/ui/#turning-existing-prs-into-a-stack).
29+
2830
### How do I add PRs to my stack?
2931

3032
Use `gh stack add <branch-name>` to add a new branch on top of the current stack. When you run `gh stack submit`, a PR is created for each branch, and they are linked together as a Stack on GitHub.
3133

32-
You can also add PRs to an existing stack from the GitHub UI. See [Adding to an Existing Stack](/gh-stack/guides/ui/#adding-to-an-existing-stack) for details.
34+
You can also add PRs to an existing stack from the GitHub UI — either a brand-new PR or an already-open PR (via the recommendation banner), added to the top of the stack. See [Adding to an Existing Stack](/gh-stack/guides/ui/#adding-to-an-existing-stack) for details.
3335

3436
### How can I modify my stack?
3537

docs/src/content/docs/guides/ui.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,31 @@ After creating the PR, you'll see the stack map appear in the header, showing bo
4343

4444
Repeat this process for each additional PR in the stack — each one targets the branch of the PR before it.
4545

46+
## Turning Existing PRs into a Stack
47+
48+
If you already have open PRs whose branches line up (each PR's base branch is the head branch of the PR below it), GitHub recognizes the chain and shows a **recommendation banner** offering to turn them into a stack.
49+
50+
![Banner recommending that eligible PRs be turned into a stack](../../../assets/screenshots/stack-recommendation-banner.png)
51+
52+
Click the banner to open a dialog that previews the stack, listing each PR in order from top to bottom. Review it and confirm to link the PRs together into a stack.
53+
54+
![Dialog previewing the stack before it's created](../../../assets/screenshots/stack-recommendation-dialog-create.png)
55+
56+
Once you confirm, the PRs are stacked and the stack map appears in each PR's header.
57+
4658
## Adding to an Existing Stack
4759

48-
If a stack already exists and you want to add a new PR to it:
60+
You can add a PR to the top of an existing stack either when you create the PR or after it already exists.
61+
62+
### Add an existing PR
63+
64+
If you already have an open PR whose base branch is the head branch of the stack's topmost PR, GitHub shows a **recommendation banner** on that PR, giving you an option to add it to the stack. Click it to preview and confirm, and the PR is added to the top of the existing stack.
65+
66+
![Recommendation dialog for adding an existing PR to a stack](../../../assets/screenshots/stack-recommendation-dialog-add.png)
67+
68+
### Create a new PR on the stack
69+
70+
To create a brand-new PR directly on top of the stack:
4971

5072
1. Open a PR in the stack, click the stack icon in the header, and click **Add**.
5173

0 commit comments

Comments
 (0)