gh-stack icon indicating copy to clipboard operation
gh-stack copied to clipboard

[Bug]: `gh stack submit` reset my second branch to zero changes and closed my PR

Open DavidObando opened this issue 1 month ago • 0 comments

Describe the bug

Upon executing gh stack submit, the changes in the second of two PRs in the stack were deleted and the PR was automatically closed. I had the changes locally still so I was able to recover.

Note the second PR in the stack is abnormally HUGE: Image

Affected command

gh stack submit

gh-stack version

0.1.1

GitHub CLI version

2.101.0

Operating system

macOS 27.0.1

Shell

zsh

Steps to reproduce

I created 2 PRs:

  • davidobando/gsharp#4890 from branch cutover/phase2-prereqs
  • davidobando/gsharp#4891 from branch cutover/phase3-migrate-to-gsharp

In a separate device where I have the stack extension I ran:

$ gh stack init cutover/phase2-prereqs cutover/phase3-migrate-to-gsharp
? Enable git rerere to remember conflict resolutions? Yes
✓ Adopted 2 branches: main ← cutover/phase2-prereqs ← cutover/phase3-migrate-to-gsharp
  You're on cutover/phase3-migrate-to-gsharp (top of stack).
  Found PRs for 2 of 2 branches.

What's next:
  • see the full stack:                          gh stack view
  • move between branches:                       gh stack switch
  • link these PRs into a Stack on GitHub:       gh stack submit

Then I ran:

$ gh stack submit
Checking stack state...
Pushing to origin...
PR #4890 for cutover/phase2-prereqs is up to date
PR #4891 for cutover/phase3-migrate-to-gsharp is up to date
✓ Stack created on GitHub with 2 PRs (stack #4892)
✓ Pushed and synced 2 branches

I went to see PR davidobando/gsharp#4891 and noticed it had been closed. It also wouldn't let me re-open it as it showed it had 0 changes, 0 commits. It's as if branch cutover/phase3-migrate-to-gsharp had immediately lost all the changes when gh stack submit ran.

To recover I did the following:

$ gh stack unstack
✓ Stack removed on GitHub (stack #4892)
✓ Stack removed from local tracking

And then force pushed the local changes I had in branch cutover/phase3-migrate-to-gsharp to its remote. After that GitHub would again allow me to re-open the PR.

Expected behavior

I expected to get both PRs in a stack, and be able to merge them together. Holding hands.

Actual behavior

Data loss. The abnormally HUGE Image diff dissapeared as if by magic.

Terminal output

See the steps to reproduce above, the output was included.

Preflight checks

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

DavidObando avatar Oct 14 '26 02:10 DavidObando