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
  • Viewing Certificates

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 Events

              • Dec
                02

                Skylight en acción: resguardando la IA más allá del usuario.

                12/02/202604:00 AM ET
                • Dec
                  03

                  CISO Insights: Steering Cybersecurity Strategies in an AI-Driven Era

                  12/03/202601:00 PM ET
                  • Dec
                    03

                    The Dilemma of Self-Hosting: Weighing the Pros and Cons

                    12/03/202601:00 PM ET
                    • Dec
                      09

                      Beyond Continuous Compliance: Getting Ready to Detect, Recalculate, and Adapt

                      12/09/202601:00 PM ET
                      • Dec
                        09

                        Strategies for Safeguarding Endpoints in the Agentic Era with Cyera

                        12/09/202602:00 PM ET
                        • Dec
                          10

                          Retain Control: The On-Prem Solution to Unwanted Cloud Migration

                          12/10/202601:00 PM ET
                          • Jan
                            19

                            Skylight in Aktion: Gewährleisten Sie KI-Schutz über den Benutzer hinaus

                            01/19/202704:00 AM ET
                            • Jan
                              19

                              HUMAN Dialogue: Embracing the Rise of the Empowered AI Consumer.

                              01/19/202702:00 PM ET
                              • Mar
                                18

                                Securing Access for People, Partners and AI Agents

                                03/18/202701:00 PM ET
                                • Jun
                                  17

                                  Stop the Leak: Data Loss Prevention for the AI Era

                                  06/17/202701:00 PM ET
                                  More events

                                  Upcoming Webinar Calendar

                                  • 12/02/2026
                                    04:00 AM
                                    12/02/2026
                                    Skylight en acción: resguardando la IA más allá del usuario.
                                    https://www.truthinit.com/index.php/channel/2147/skylight-en-acción-resguardando-la-ia-más-allá-del-usuario/
                                  • 12/03/2026
                                    01:00 PM
                                    12/03/2026
                                    CISO Insights: Steering Cybersecurity Strategies in an AI-Driven Era
                                    https://www.truthinit.com/index.php/channel/2231/ciso-insights-steering-cybersecurity-strategies-in-an-ai-driven-era/
                                  • 12/03/2026
                                    01:00 PM
                                    12/03/2026
                                    The Dilemma of Self-Hosting: Weighing the Pros and Cons
                                    https://www.truthinit.com/index.php/channel/2280/the-dilemma-of-self-hosting-weighing-the-pros-and-cons/
                                  • 12/09/2026
                                    01:00 PM
                                    12/09/2026
                                    Beyond Continuous Compliance: Getting Ready to Detect, Recalculate, and Adapt
                                    https://www.truthinit.com/index.php/channel/2250/beyond-continuous-compliance-getting-ready-to-detect-recalculate-and-adapt/
                                  • 12/09/2026
                                    02:00 PM
                                    12/09/2026
                                    Strategies for Safeguarding Endpoints in the Agentic Era with Cyera
                                    https://www.truthinit.com/index.php/channel/2256/strategies-for-safeguarding-endpoints-in-the-agentic-era-with-cyera/
                                  • 12/10/2026
                                    01:00 PM
                                    12/10/2026
                                    Retain Control: The On-Prem Solution to Unwanted Cloud Migration
                                    https://www.truthinit.com/index.php/channel/2267/retain-control-the-on-prem-solution-to-unwanted-cloud-migration/
                                  • 01/19/2027
                                    04:00 AM
                                    01/19/2027
                                    Skylight in Aktion: Gewährleisten Sie KI-Schutz über den Benutzer hinaus
                                    https://www.truthinit.com/index.php/channel/2176/skylight-in-aktion-gewährleisten-sie-ki-schutz-über-den-benutzer-hinaus/
                                  • 01/19/2027
                                    02:00 PM
                                    01/19/2027
                                    HUMAN Dialogue: Embracing the Rise of the Empowered AI Consumer.
                                    https://www.truthinit.com/index.php/channel/2160/human-dialogue-embracing-the-rise-of-the-empowered-ai-consumer/
                                  • 03/18/2027
                                    01:00 PM
                                    03/18/2027
                                    Securing Access for People, Partners and AI Agents
                                    https://www.truthinit.com/index.php/channel/2251/securing-access-for-people-partners-and-ai-agents/
                                  • 06/17/2027
                                    01:00 PM
                                    06/17/2027
                                    Stop the Leak: Data Loss Prevention for the AI Era
                                    https://www.truthinit.com/index.php/channel/955/360view-stop-the-leak-data-loss-prevention-for-the-ai-era/
                                  • 08/19/2027
                                    01:00 PM
                                    08/19/2027
                                    Who Has Access to What...and Should They?
                                    https://www.truthinit.com/index.php/channel/2252/who-has-access-to-what-and-should-they/
                                  • 10/21/2027
                                    01:00 PM
                                    10/21/2027
                                    After VMware: Building the Private Cloud You Actually Want
                                    https://www.truthinit.com/index.php/channel/2253/after-vmware-building-the-private-cloud-you-actually-want/
                                  • 11/18/2027
                                    01:00 PM
                                    11/18/2027
                                    Assume Breach, Prove Recovery
                                    https://www.truthinit.com/index.php/channel/2254/assume-breach-prove-recovery/
                                  • 12/16/2027
                                    01:00 PM
                                    12/16/2027
                                    The Self-Running Service Desk
                                    https://www.truthinit.com/index.php/channel/2255/the-self-running-service-desk/
                                  Truth in IT
                                  • Sponsor
                                  • About Us
                                  • Terms of Service
                                  • Privacy Policy
                                  • Contact Us
                                  • Preference Management
                                  Desktop version
                                  Standard version