Skip to content

[Bug]: gh stack rebase fails whenever an upstack HEAD has moved #598

Open

Description

@eizengan

Describe the bug

Whenever an upstack HEAD has moved (e.g. by adding a commit or rebasing) the stack fails to rebase even when that rebase is trivial. The GitHub Pull Request web UI can still rebase such stacks automatically and cleanly when the "Rebase stack" button is clicked. I know for a fact that gh stack rebase used to work in exactly this context

Affected command

gh stack rebase

gh-stack version

0.3.0

GitHub CLI version

https://github.com/cli/cli/releases/tag/v2.98.0

Operating system

macOS 26.7.1

Shell

zsh

Steps to reproduce

  1. Create a stack of two pull requests
  2. Add a trivial-to-rebase commit to the branch of the PR at the bottom of the stack (e.g. adding a new file)
  3. Push the new commit
  4. gh stack rebase

Expected behavior

  1. The bottom pull request will rebase on main
  2. The top pull request will rebase on the (rebased) branch of the bottom pull request
  3. The command exits with a success

Actual behavior

  1. The bottom pull request will rebase on main
  2. The top pull request remains unchanged
  3. The command exits with a failure

Terminal output

Rebasing branches in order, starting from stack-merged to stack-top
✓ Skipping stack-merged (PR #1 (https://github.com/example/example/pull/1) merged)
✓ Rebased stack-bottom onto main (adjusted for merged PR)
✗ could not determine the previous base of stack-top after stack-bottom changed; rebase this branch manually
✗ no rebase in progress

Preflight checks

  • I searched the existing issues for duplicates.
  • I ran gh extension upgrade stack and reproduced this issue on the latest stable release.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug Reports

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions