In short.
This GitHub tutorial helps developers and reviewers divide AI-generated features into focused pull requests, but teams must manage dependent branches and validate every layer. It combines GitHub Copilot CLI with gh-stack and follows an authentication feature from planning through merging. Its main value is a concrete explanation of where changes belong and how fixes move through the stack. The page provides commands and example prompts, but no measured productivity results or execution evidence. Operational behavior has not been tested, and costs and licensing terms are unknown from this source.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage includes the complete selected documentation page at [https://docs.github.com/api/article/body?pathname=/en/copilot/tutorials/stack-ai-generated-code-in-pull-requests], including prerequisites, the manual-command note, all seven stages, example prompts and further-reading references. Linked pages and the referenced extension and skill implementations are excluded. No licensing notice appears in the supplied text. Installation, authentication, code generation, tests, rebasing and merging were not executed or independently verified.
The overview
Identity
Stack AI-generated code in pull requests is a GitHub documentation tutorial about keeping large AI-assisted changes reviewable. Its example uses GitHub Copilot CLI and the gh-stack CLI extension and agent skill.
The original page is [https://docs.github.com/api/article/body?pathname=/en/copilot/tutorials/stack-ai-generated-code-in-pull-requests]. The resource is instructional documentation; the extension and agent skill it references are separate components.
Assessment
The tutorial is useful for teams whose AI-generated features become too large to review comfortably. It connects feature planning to branch structure, self-review, reviewer feedback and merging, giving readers a complete conceptual path through a stack.
Its strongest guidance is to keep each layer coherent and place corrections on the branch where they belong. Claims about quicker or more effective reviews are qualitative: the page supplies no measured review times, defect rates or comparison results.
Users
The intended readers are developers generating code with agents and teammates reviewing that code. The workflow also supports different reviewers handling different layers, such as a data model and the endpoints that use it.
Beginners receive an explanation of stacks and concrete commands, but the tutorial does not teach Git fundamentals. Familiarity with branches, commits, pull requests and rebasing would help readers follow the instructions. Experienced developers may find the dependency planning and feedback propagation guidance most useful.
Capabilities
The tutorial covers designing dependency-ordered layers, creating the first branch, adding subsequent branches, submitting pull requests, reviewing each layer, applying feedback and merging from the bottom upward.
It presents agent prompts alongside manual commands for initializing, extending, submitting, navigating and rebasing a stack. It also describes optional auto-merge or merge-queue use once approvals and checks pass. These are documented workflow capabilities; successful execution is not established by the supplied evidence.
Using it
Requirements
The stated prerequisites are GitHub CLI 2.90.0 or later, Git 2.20 or later, a GitHub repository you can push to, and GitHub Copilot CLI installed and signed in. GitHub CLI must be authenticated through gh auth login.
The agent-assisted route also requires installing the gh-stack extension and skill. The page does not specify an operating system, programming language, Copilot CLI version or gh-stack version, and it does not explain subscription or organization access requirements.
Mechanism
A stack is an ordered chain of pull requests in one repository. The bottom pull request targets the destination branch, typically main, and each higher pull request targets the branch immediately below it. Reviewers therefore see each layer's changes relative to its parent instead of the entire feature.
When a lower layer changes, the tutorial directs the agent or developer to rebase the branches above it so they inherit the correction. It describes bottom-up merging and automatic retargeting of the next pull request to main. Independently reviewable layers still depend on earlier layers; the page does not establish that each layer is independently deployable.
Setup
After meeting the prerequisites and authenticating, the documented installation commands are gh extension install github/gh-stack and gh skill install github/gh-stack. Plan the feature's layers before asking Copilot to generate code.
For manual operation, the page gives gh stack init BRANCH-NAME-1 to start the stack, gh stack add BRANCH-NAME-NEXT to add a layer, and gh stack submit to create the pull requests. Navigation uses gh stack down, gh stack up or gh stack checkout BRANCH-NAME. After committing a correction, gh stack rebase --upstack carries it into higher branches. These commands were not executed.
Example
The example divides user authentication into four layers: the data model and migration; create, read, update and delete endpoints; JSON Web Token middleware and guards; and integration and unit tests. Each layer builds on the work below it.
An initial agent request would ask for only the user model and migration. A later request would add the endpoints on a new branch above it. For feedback, the tutorial illustrates fixing expired-token handling on the relevant branch, then propagating the correction upward. Although tests appear as a separate example layer, the instructions also call for tests, linters and code scanning on every branch.
Assessment & evidence
Limitations
Stacks require deliberate boundaries and dependency order. The tutorial warns that mistakes in the bottom layer affect higher branches, oversized layers may need splitting, and corrections placed on the wrong branch can cause confusion and errors.
The page does not provide a worked conflict-resolution procedure, failed-rebase recovery steps or detailed instructions for configuring branch protections and merge queues. Its authentication example is a layering illustration, not a complete authentication implementation or security design. No runtime, compatibility or merge behavior was tested.
Reasoning
The proposed benefit follows from narrowing what a reviewer must consider at once: each pull request presents a coherent addition relative to its parent. Ordering layers by dependency also helps reviewers understand how the feature develops.
The tutorial assigns responsibility for the stack's shape to the developer, even when Copilot helps plan it. A practical implication is that adoption depends on a team's ability to define useful boundaries and keep higher layers aligned after feedback. Smaller diffs support review but do not establish code correctness.
Alternatives
The explicit alternative within the tutorial is operating the stack yourself through GitHub CLI instead of asking Copilot to perform stack commands. This retains the same dependent-branch structure and gh-stack tooling.
The page contrasts stacks with one large pull request, highlighting the review difficulties of the latter. It does not compare competing stack-management tools or document equivalent workflows for other repository hosts.
Evidence
The evidence is the complete supplied GitHub documentation page. It contains a definition of stacked pull requests, prerequisites, installation and operation commands, seven workflow stages and example agent prompts.
The page documents intended use but contains no execution transcript, benchmark, completed example repository or test results. The linked review tutorial, stacked-pull-request guidance, extension implementation and skill contents are outside the assessed material.
Access & freshness
Costs
The page gives no prices, Copilot subscription tiers, usage allowances or billing details. The cost of obtaining the required access is unknown from this evidence.
It also provides no estimate of setup time, rebase effort or reviewer time saved. There is no basis here for calculating financial savings or a return on adoption.
Rights
The supplied page text contains no license or reuse notice. It does not establish redistribution terms for the documentation or licensing terms for the gh-stack extension and agent skill.
The extension and skill contents are outside the supplied evidence. Their permissions and obligations remain unknown here.
Freshness
The supplied capture is dated 24 November 2026. The page text does not give a publication or last-updated date, so the capture date does not establish when the guidance was written.
The page specifies minimum GitHub CLI and Git versions but leaves Copilot CLI and gh-stack versions unspecified. Compatibility with particular releases and any changes after capture are unknown.
Actions
Before following the tutorial, confirm the required CLI versions, repository push access and Copilot sign-in. Define a dependency-ordered plan with one coherent change per layer, then inspect the foundation before building higher branches.
Run the project's tests, linters and code scanning on each branch before requesting reviews. Put feedback fixes in their owning layer, propagate them upward and recheck affected code. Confirm access costs and applicable licensing terms separately, since the page does not supply them.
