gh-stack is a GitHub CLI extension for managing stacked branches and pull requests. Stacked pull requests break a large change into a chain of smaller changes, with each branch based on the one below it. This gives reviewers a focused diff for each layer while developers continue working further up the stack.
The extension keeps stack metadata alongside the Git repository and coordinates local branches with GitHub’s stack information. It is aimed at terminal users who want common stacked-branch operations handled through the gh stack command rather than manually updating branch bases, pull requests and local tracking data.
This is free and open source software.
Key Features
- Initialise a stack from new branches or adopt existing branches.
- Add a branch to the top of a stack, with optional staging and commit creation as part of the command.
- Submit a stack to GitHub and create one pull request for each branch with the correct dependent base.
- Check out stacks by stack number, pull request number, pull request URL or branch name.
- Discover and pull remote-only stacks into a local repository.
- Navigate with commands for moving up or down a stack or jumping directly to its top, bottom or trunk.
- Rebase and synchronise stacks while preserving their branch relationships.
- Work with stacks distributed across linked Git worktrees.
- View stacks interactively, in compact form or as JSON for scripting.
- Merge stacked pull requests up to a chosen point, with GitHub enforcing branch protection and repository rules.
- Remove local stack tracking or unstack pull requests on GitHub.
- Interactive terminal screens adapt automatically to light and dark terminal backgrounds.
Website: github.com/github/gh-stack
Support:
Developer: GitHub
License: MIT License
gh-stack is written in Go. Learn Go with our recommended free books and free tutorials.
Related Software
| Git Workflow Tools | |
|---|---|
| git-extras | Superb collection of tools for Git |
| forgit | Utility for using git interactively |
| wrkflw | Validate and run GitHub Actions workflows locally |
| git-branchless | Branchless workflow for git |
| git-absorb | Super-charging git rebase |
| git-toolbelt | Suite of useful Git commands |
| git-open | Adds a handy git open command to Git. |
| git-town | Automate the creation, synchronization, shipping, and cleanup |
| git-fuzzy | Interactive git with the help of fzf |
| git-recent | Jump between recently used local Git branches |
| git-machete | Robust tool that simplifies your git workflows |
| git-flow-next | Modern implementation of the Git-flow branching model |
| Git Interactive Rebase Tool | Terminal-based sequence editor for interactive rebase |
| git-crecord | Interactively select changes to commit or stage |
| git-xargs | Update across multiple GitHub repositories |
| git-prompt.zsh | Lightweight git prompt for zsh |
| git-imerge | Incremental merge and rebase for Git |
| git revise | Git subcommand and Python library |
| wtp | Enhanced Git worktree management |
| LazyWorktree | Git worktree management for the terminal |
| Hug SCM | The Humane Source Control Management Interface |
| git-smart | Small collection of Git helper commands |
| stax | CLI and TUI for stacked Git branches and PRs |
| git-fixup | Command-line helper for Git users |
| git-autofixup | Git helper that creates fixup commits for topic branches |
| Branchlet | Create and manage Git worktrees |
| git-when-merged | Merge commit finder |
| git-flow | High-level repository operations |
Read our verdict in the software roundup.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.