Skip to content

Releases: github/gh-stack

v0.0.4

15 May 18:05
d3be1b5

Choose a tag to compare

Note

Stacked PRs is currently in private preview. This CLI and the referenced functionality will not work unless the feature has been enabled for your repository.
You can sign up for the waitlist at gh.io/stacksbeta.

gh-stack is a GitHub CLI extension for managing stacked branches and pull requests. Learn more about GitHub Stacked PRs here.

View the Quick Start guide or upgrade to the latest version with:

gh extension upgrade stack

What's new in v0.0.4

Added

  • gh stack sync --prune: New flag (and interactive prompt) to delete local branches and remote-tracking refs for merged PRs during sync.
  • gh stack init multi-branch support: Pass multiple branch names as arguments to init; existing branches are adopted automatically without any extra flag.
  • Contextual post-command hints: After add, push, submit, and checkout, the CLI now prints "what to do next" suggestions to guide users through the workflow.
  • Rebase workflow docs: New comprehensive "Rebasing Your Stack" section in the workflows guide covering cascading rebase, conflict resolution, and CLI vs. web UI differences.
  • Grouped root help: Root gh stack --help now organizes commands into categories (Core, Stack Management, Navigation, Other) with a "Learn More" footer linking to docs and feedback.

Changed

  • gh stack merge removed: The command was a placeholder that opened the browser rather than performing a real merge; it will be re-added once the merge API for Stacked PRs is available.
  • gh stack init prefix detection: The --adopt flag is deprecated (hidden but still accepted); branch prefix is now auto-derived from branch names (e.g. feat/a feat/b → prefix feat) instead of prompting upfront.
  • TUI merged-branch guards: Merged branches can no longer be selected via keyboard, mouse click, or Enter in the stack view or modify TUI; the cursor skips over them automatically.
  • Improved CLI help text: All commands now have Long descriptions and Example blocks with real-world, commented usage for better discoverability.

Fixed

  • gh stack submit on partially-merged stacks: Merged PRs are now included in the API payload, preventing "Stack contents have changed" rejections when some branches in a stack have already been merged.

Changelog

  • Bump astro from 6.1.8 to 6.3.1 in /docs in the npm_and_yarn group across 1 directory by @dependabot[bot] in #86
  • Bump devalue from 5.6.4 to 5.8.1 in /docs in the npm_and_yarn group across 1 directory by @dependabot[bot] in #90
  • commands help text by @skarim in #88
  • remove merge command by @skarim in #89
  • support multiple branches during init by @skarim in #91
  • docs on rebase workflow by @skarim in #93
  • prune merged branches by @skarim in #94

Full Diff: v0.0.3...v0.0.4

v0.0.3

11 May 15:20
8dbd7c6

Choose a tag to compare

What's new in v0.0.3

Added

  • gh stack modify: New interactive TUI command to restructure a stack — drop, fold, rename, and reorder branches — applied atomically with cascading rebases and conflict recovery (--continue / --abort).
  • gh stack submit --open: New --open flag to create PRs as ready for review; PRs are now created as drafts by default, with --open also converting existing drafts to ready for review.
  • PR template support: gh stack submit and gh stack link now automatically detect and use the repository's pull request template as the PR body.
  • gh stack view --json agent improvements: When --json is set and the stack is ambiguous, the command now returns a proper exit code instead of launching an interactive prompt.

Changed

  • gh stack unstack simplified: The optional [branch] argument is removed; the command always targets the active (currently checked-out) stack.
  • TUI load performance: API calls in sync and git operations in LoadBranchNodes are now parallelized; a "Loading stack..." indicator is shown while data is fetched.
  • Reduced GraphQL footprint: Removed ~15 unused fields across 5 queries and deleted one dead query, reducing API rate limit consumption.
  • Docs corrections: FAQ answers updated to reflect atomic landing behavior, merge queue grouping, and gh stack modify as the primary stack restructuring tool.

Fixed

  • git push --force-with-lease failures on shallow clones: A targeted git fetch of active branches now runs before every push, ensuring remote tracking refs are up to date.
  • GraphQL int32 overflow: PR numbers are now validated before conversion to graphql.Int, preventing silent truncation on very large PR numbers.

Changelog

  • Bump astro from 6.0.8 to 6.1.8 in /docs in the npm_and_yarn group across 1 directory by @dependabot[bot] in #60
  • Guard GraphQL PR number conversion against int32 overflow by @Copilot in #56
  • docs: stack object in pull_request webhooks by @Copilot in #67
  • modify command by @skarim in #72
  • Bump postcss from 8.5.8 to 8.5.14 in /docs in the npm_and_yarn group across 1 directory by @dependabot[bot] in #73
  • docs content updates by @skarim in #83
  • simplify unstack to only target the active stack by @skarim in #74
  • run fetch before push operations by @skarim in #75
  • open PRs as draft by default by @skarim in #76
  • use PR template when opening PRs by @skarim in #77
  • trim GraphQL queries by @skarim in #78
  • optimize TUI load times by @skarim in #79
  • improve agent friendliness of view --json by @skarim in #80

Full Diff: v0.0.2...v0.0.3

v0.0.2

20 Apr 15:29

Choose a tag to compare

What's new in v0.0.2

Added

  • gh stack link: New API-only command to create and link a stack on GitHub from branch names or PR numbers — ideal for users managing branches with external tools like jj, Sapling, or ghstack.
  • gh stack switch: New interactive picker command to switch to any branch in the current stack, displayed in order with position numbers.
  • Stacked PR preflight check: gh stack submit now verifies stacked PR availability before pushing branches, prompting to create regular PRs instead if stacks aren't enabled for the repository.

Changed

  • gh stack sync and gh stack rebase fast-forward: Stack branches where local is strictly behind remote are now fast-forwarded before the cascade rebase, preventing upstream commits from being dropped.

Fixed

  • gh stack checkout on partially-merged stacks: Merged branches are now skipped when checking out a remote stack; a message is shown if the stack is fully merged.
  • Inflated diff counts in gh stack view: git merge-base is now always used to find the fork point for diff computation, preventing inflated file counts when the base branch has advanced since stack init.
  • gh stack rebase crash on deleted branches: Merged branches that no longer exist locally are filtered out before resolving refs, preventing a rev-parse failure during the cascade rebase.
  • gh stack sync crash on deleted branches: Same fix applied to the sync code path — deleted merged branches are skipped when building the ref snapshot.
  • --onto rebase failures after partial merges: Fixed three edge cases where git rebase --onto would fail or replay already-applied commits after branches in the stack had been merged.
  • Stale merged/closed PRs adopted for reused branch names: gh stack submit and gh stack view no longer pick up old merged or closed PRs when a branch name is reused in a new stack.

Changelog

  • skip pulling merged branches during remote checkout by @skarim in #16
  • docs site styling by @skarim in #20
  • docs site content updates by @skarim in #28
  • fix for inflated diff counts when base branch has been updated since stack init by @skarim in #39
  • fast forward active branches where local is behind remote by @skarim in #40
  • fix for rev-parse error when rebasing over deleted branches by @skarim in #41
  • fix for rev-parse error during sync with deleted branches by @skarim in #42
  • fix --onto rebase for merged branches by @skarim in #43
  • minor docs styling & content updates by @skarim in #48
  • preflight check for stacked PR availability in submit by @skarim in #44
  • ignore stale merged/closed PRs for reused branch names by @skarim in #49
  • link command for api-only operations by @skarim in #50
  • switch command by @skarim in #51

Full Diff: v0.0.1...v0.0.2

v0.0.1

10 Apr 07:49

Choose a tag to compare

Note

Stacked PRs is currently in private preview. This CLI and the referenced functionality will not work unless the feature has been enabled for your repository.
You can sign up for the waitlist at gh.io/stacksbeta.

gh-stack is a GitHub CLI extension for managing stacked branches and pull requests. Learn more about GitHub Stacked PRs here.

Quick Start

Make sure you have the gh CLI installed first, then run:

gh extension install github/gh-stack

You can optionally set up an alias to use gs instead of gh stack:

gh stack alias

Navigate to your repo and start stacking:

# Start a new stack from your default branch
gs init 
# ... make changes, stash, and commit using git

# Add a new branch to the stack
gs add next-branch
# ... make changes, stash, and commit using git

# Push all branches
gs push

# Open a stack of PRs
gs submit

Full details of the CLI and available commands here.

Use with Agents

Teach agents how to use the CLI by installing the included skill:

npx skills add github/gh-stack

Upgrading

If you already have the extension installed, upgrade to the latest release with:

gh extension upgrade stack

Full Changelog: https://github.com/github/gh-stack/commits/v0.0.1