Truth in IT
    • Sign In
    • Register
        • Videos
        • Channels
        • Pages
        • Galleries
        • News
        • Events
        • All
Truth in IT Truth in IT
  • Data Management ▼
    • Converged Infrastructure
    • DevOps
    • Networking
    • Storage
    • Virtualization
  • Cybersecurity ▼
    • Application Security
    • Backup & Recovery
    • Data Security
    • Identity & Access Management (IAM)
    • Zero Trust
    • Compliance & GRC
    • Endpoint Security
  • Cloud ▼
    • Hybrid Cloud
    • Private Cloud
    • Public Cloud
  • Webinar Library
  • TiPs
  • DRAW

Modify & Submit Stacked PRs with GitHub CLI

Github
10/13/2026
0 (0%)
Share
  • Comments
  • Download
  • Transcript
Report Like Favorite
  • Share/Embed
  • Email
Link
Embed

Transcript


you have to check out the extension for the GitHub CLI. I'm going to show you how I just used it. I just wrapped up some work. Originally, we had three layers in our stack, but then I noticed that there's one layer that doesn't make sense on its own. And that's the key when working with stacked PRs is you want to make sure your changes exist in a layer that makes sense within the context of that layer. So I'm going to use gh-stack-modify to fold changes into another layer to do some renaming, and then we'll use gh-stack-submit to get everything into our pull requests on github.com. And then we'll go ahead and merge one by one. I'm going to type in gh-stack-view. And here we can look at all of the layers that we have in our stack. If I hit the F key, I can see the files, right? We hit C, you can see the commits. In this stack, we created a slash community page for my LearnToCloud website. And we've made changes to the UI, to the metrics that are shown here. We have some curriculum updates and such. But from a reviewing context, there are a couple of changes I'd like to make. I'm going to type in gh-stack-modify now. The first thing I want to do is fold. So I'd like to fold this data model layer up into the page layer. So I'm going to make sure I'm on that. You can just use the arrows up and down. And then I'm going to hit the U key. And now we see it says pending one fold. This will fold up. So all of the work that I've done here is going to fold up here. Additionally, another change I want to do is rename this layer. I'm going to type in page-ui-updates. Fantastic. And now all I have to do to save all these changes is hit Control-S. Now we do gh-stack-view. And we see we have those modifications in place. In order to submit this, I will type in gh-stack-submit. And I will use auto and open, which will create the PRs and set them to open instead of draft. So I'll hit Enter. Great, so we can see everything was created there. Let's head over to github.com to review. So I'm in my pull requests tab and we see both of the PRs here and we see the stack icon as well. I'm going to click on 684. You can click on the stack map icon here to move across layers if you'd like. But I want to take a look down here and our CI that runs whenever we have something targeting main is currently running. So let's give this a moment to complete. Great, so all checks have passed. If I scroll down, I can see both of my layers in the stack. I'm going to do this bottoms up, of course, and I want to do this one by one. So I'm going to go ahead and squash and merge this one here. And what is going to happen now is that automatically our next layer is going to target main. So it's going to retarget, right? So I'm going to actually go in and click into this because it is now going to retarget to main. All the CI checks have to run here as well. So I'll have to wait for these to complete before I can merge them. Fantastic, and all checks have passed for this layer as well. I can go ahead, squash and merge. And there we go. All my work has been merged into main. So make sure you are using the extension for stacked PRs with the GitHub CLI. And just remember, there's so much flexibility in terms of how you want to merge, in terms of modifications you can make to your stacked PRs. There's an agent skill you can leverage in so much more. I'll make sure there is documentation linked somewhere so you can dive right in.

TL;DR

  • The GitHub CLI stacked PRs extension lets you inspect all layers of a stack using `gh stack view`, with keyboard shortcuts to browse files and commits per layer.
  • Use `gh stack modify` to fold redundant layers into adjacent ones and rename them, ensuring every PR layer is coherent and reviewable on its own.
  • `gh stack submit` opens all PRs on GitHub in a single command; merging bottom-up triggers automatic retargeting so each subsequent layer points to main.

Summary

This hands-on demo walks through the GitHub CLI extension for stacked pull requests, showing how to inspect, reorganize, and submit a multi-layer PR stack before merging into main. The presenter starts with a real-world scenario: a three-layer stack where one layer — a data model change — doesn't stand on its own as a meaningful, reviewable unit. Using `gh stack view`, developers can browse all layers in the stack, toggling between file diffs and commit history with simple keyboard shortcuts. The `gh stack modify` command then enables two key cleanup actions: folding a redundant layer up into an adjacent one, and renaming layers to better reflect their purpose. After saving changes with Control-S, `gh stack submit` opens the pull requests on GitHub with a single command, using the `--auto --open` flags to publish them as open PRs rather than drafts. On GitHub.com, the stack icon provides visual navigation across layers, and CI checks run automatically against each PR. Merging proceeds bottom-up — squash-merging the base layer triggers automatic retargeting of the next layer to main, so each subsequent PR is ready to merge once its CI checks pass. The workflow closes with a reminder that the extension supports flexible merge strategies and additional capabilities including an agent skill, with full documentation linked for deeper exploration.

Chapters

0:00 - Why Clean Up PR Layers?
0:40 - Inspecting with gh stack view
1:16 - Folding and Renaming Layers
2:14 - Submitting with gh stack submit
2:33 - Reviewing PRs on GitHub.com
3:21 - Auto-Retargeting and Final Merge
3:56 - Summary and Next Steps

Key Quotes

0:14 "That's the key when working with stacked PRs — you want to make sure your changes exist in a layer that makes sense within the context of that layer."
2:14 "In order to submit this, I will type in gh stack submit. And I will use auto and open, which will create the PRs and set them to open instead of draft."
3:23 "Automatically our next layer is going to target main. So it's going to retarget."
4:03 "There's so much flexibility in terms of how you want to merge, in terms of modifications you can make to your stacked PRs. There's an agent skill you can leverage and so much more."

FAQ

What does 'folding' a layer mean in the context of gh stack modify?

Folding merges the commits from one layer up into the layer above it, consolidating changes that don't stand alone as a meaningful unit into a more logical grouping before the PRs are submitted for review.

Do I need to manually retarget PRs after merging the first layer in a stack?

No — after squash-merging the base layer, GitHub automatically retargets the next PR in the stack to point at main, though CI checks will re-run on the retargeted PR before you can merge it.


Categories:
  • » Cybersecurity » Application Security
  • » Data Protection
Channels:
News:
Events:
Tags:
  • Demo
  • How-To
  • DevSecOps
  • Getting Started
  • Technical Deep Dive
  • Stacked Pull Requests
  • GitHub CLI
  • Code Review Workflow
  • Pull Request Management
  • Developer Productivity
  • Branch Management
  • CI
  • CD Integration
  • Git Workflow
Show more Show less

Browse videos

  • Related
  • Featured
  • By date
  • Most viewed
  • Top rated
  •  

              Video's comments: Modify & Submit Stacked PRs with GitHub CLI

              Upcoming 360 View Events

              • Nov
                19

                360View: Govern, Secure & Recover Your Microsoft 365 Environment

                11/19/202601:00 PM ET
                More events

                XStreaminars (watch here)

                • Oct
                  28

                  EnvZero: Near-Zero Time to Resolution--Live Agentic Remediation for Failed and Drifted Infrastructure

                  10/28/202601:00 PM ET
                  More events

                  Industry Events (Sponsor Hosted)

                  • Oct
                    13

                    Ensuring Compliance: Audit Evidence from CJIS to FERPA

                    10/13/202601:00 PM ET
                    • Oct
                      15

                      Risk in Real Time Demo Series: Virtual Patching: Protection at the Speed of Exploitation

                      10/15/202611:00 AM ET
                      • Oct
                        20

                        Harnessing Data Governance for AI with Cyera and Snowflake

                        10/20/202611:00 AM ET
                        • Oct
                          27

                          Maximize Your Microsoft Investment for Security and Growth

                          10/27/202611:00 AM ET
                          • Oct
                            27

                            The HUMAN Experience: Real-Time Insights into Page Intelligence

                            10/27/202601:00 PM ET
                            More events

                            Upcoming Webinar Calendar

                            • 10/13/2026
                              01:00 PM
                              10/13/2026
                              Ensuring Compliance: Audit Evidence from CJIS to FERPA
                              https://www.truthinit.com/index.php/channel/2159/ensuring-compliance-audit-evidence-from-cjis-to-ferpa/
                            • 10/15/2026
                              11:00 AM
                              10/15/2026
                              Risk in Real Time Demo Series: Virtual Patching: Protection at the Speed of Exploitation
                              https://www.truthinit.com/index.php/channel/1372/risk-in-real-time-demo-series-the-autonomous-era-orchestrating-a-resilient-enterprise/
                            • 10/20/2026
                              11:00 AM
                              10/20/2026
                              Harnessing Data Governance for AI with Cyera and Snowflake
                              https://www.truthinit.com/index.php/channel/2137/harnessing-data-governance-for-ai-with-cyera-and-snowflake/
                            • 10/27/2026
                              11:00 AM
                              10/27/2026
                              Maximize Your Microsoft Investment for Security and Growth
                              https://www.truthinit.com/index.php/channel/2178/maximize-your-microsoft-investment-for-security-and-growth/
                            • 10/27/2026
                              01:00 PM
                              10/27/2026
                              The HUMAN Experience: Real-Time Insights into Page Intelligence
                              https://www.truthinit.com/index.php/channel/2139/the-human-experience-real-time-insights-into-page-intelligence/
                            • 10/28/2026
                              01:00 AM
                              10/28/2026
                              [APAC:] Secure AI Everywhere: Visibility, governance and protection for the agentic era
                              https://www.truthinit.com/index.php/channel/2125/apac-ensuring-comprehensive-security-for-ai-applications/
                            • 10/28/2026
                              06:00 AM
                              10/28/2026
                              [EMEA:] Secure AI Everywhere: Visibility, governance and protection for the agentic era
                              https://www.truthinit.com/index.php/channel/2127/emea-ensuring-ai-security-across-all-platforms/
                            • 10/28/2026
                              01:00 PM
                              10/28/2026
                              [AMERICAS:] Secure AI Everywhere: Visibility, governance and protection for the agentic era
                              https://www.truthinit.com/index.php/channel/2126/securing-ai-across-the-americas-strategies-and-insights/
                            • 10/28/2026
                              01:00 PM
                              10/28/2026
                              EnvZero: Near-Zero Time to Resolution--Live Agentic Remediation for Failed and Drifted Infrastructure
                              https://www.truthinit.com/index.php/channel/2179/envzero-near-zero-time-to-resolution-live-agentic-remediation-for-failed-and-drifted-infrastructure/
                            • 11/04/2026
                              11:00 AM
                              11/04/2026
                              Leveraging CISA’s Zero Trust Maturity Model in an AI-Driven Landscape
                              https://www.truthinit.com/index.php/channel/2149/leveraging-cisas-zero-trust-maturity-model-in-an-ai-driven-landscape/
                            • 11/04/2026
                              11:00 AM
                              11/04/2026
                              Aligning Agentic Intent: Understanding Your Agents' Purpose vs. Their Actions
                              https://www.truthinit.com/index.php/channel/2158/aligning-agentic-intent-understanding-your-agents-purpose-vs-their-actions/
                            • 11/05/2026
                              02:00 PM
                              11/05/2026
                              HUMAN Dialogue: Embracing the Rise of the Agentic Consumer in AI
                              https://www.truthinit.com/index.php/channel/2160/human-dialogue-embracing-the-rise-of-the-agentic-consumer-in-ai/
                            • 11/05/2026
                              02:00 PM
                              11/05/2026
                              Reclaim Your Evenings: Leverage Data Intelligence to Minimize Risk and Boost AI Adoption
                              https://www.truthinit.com/index.php/channel/2172/reclaim-your-evenings-leverage-data-intelligence-to-minimize-risk-and-boost-ai-adoption/
                            • 11/19/2026
                              01:00 PM
                              11/19/2026
                              360View: Govern, Secure & Recover Your Microsoft 365 Environment
                              https://www.truthinit.com/index.php/channel/2076/360view-govern-secure-recover-your-microsoft-365-environment/
                            • 11/19/2026
                              01:00 PM
                              11/19/2026
                              Zendesk Deep Dive: Get the work done faster with Employee Service AI Agents
                              https://www.truthinit.com/index.php/channel/2181/zendesk-deep-dive-get-the-work-done-faster-with-employee-service-ai-agents/
                            Truth in IT
                            • Sponsor
                            • About Us
                            • Terms of Service
                            • Privacy Policy
                            • Contact Us
                            • Preference Management
                            Desktop version
                            Standard version