gh-stack
gh-stack copied to clipboard
[Bug]: `gh stack rebase` fails whenever an upstack HEAD has moved
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
- Create a stack of two pull requests
- Add a trivial-to-rebase commit to the branch of the PR at the bottom of the stack (e.g. adding a new file)
- Push the new commit
gh stack rebase
Expected behavior
- The bottom pull request will rebase on main
- The top pull request will rebase on the (rebased) branch of the bottom pull request
- The command exits with a success
Actual behavior
- The bottom pull request will rebase on main
- The top pull request remains unchanged
- 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
- [x] I searched the existing issues for duplicates.
- [x] I ran
gh extension upgrade stackand reproduced this issue on the latest stable release.