Repository navigation
Handle partial unstacking in sync and checkout - #576
Merged
skarim merged 1 commit intoOct 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review identified no blocking issues in the shared handling, command integration, or regression coverage; tests were not executed.
No open issues 🎉
What changed in this PR
Updates sync and checkout to handle partial unstacking safely while preserving local branch layout.
Changes:
- Shares keep-local handling across both commands, accepting merged-only remnants and retaining associations on blocked outcomes.
- Adds regression coverage for successful, partial, and failed unstacking.
- Updates prompts and documentation to avoid promising remote stack deletion.
| File | Description |
|---|---|
| README.md | Explains partial unstacking and recreation. |
| docs/src/content/docs/reference/cli.md | Updates sync conflict-resolution guidance. |
| docs/src/content/docs/guides/workflows.md | Documents keep-local behavior. |
| cmd/utils.go | Centralizes safe unstacking and lookup-error handling. |
| cmd/sync_test.go | Covers sync outcomes and verifies no pushing or recreation. |
| cmd/checkout.go | Uses shared handling and injectable selection. |
| cmd/checkout_test.go | Covers checkout outcomes and local-stack preservation. |
Review effort: Balanced
skarim
force-pushed
the
skarim/fix-keep-local-partial-merge
branch
from
October 21, 2026 19:35
50d4a66 to
14706fe
Compare
skarim
force-pushed
the
skarim/fix-keep-local-partial-merge
branch
from
October 21, 2026 19:48
14706fe to
620c787
Compare
Lukeghenco
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the "unstack on GitHub and keep local" choices in
gh stack syncandgh stack checkoutto handle merged PRs remaining in the old remote stack. Both paths preserve the local branch layout and only detach the remote association when recreation is safe.Functionality and user impact
submit; prompts now describe unstacking rather than guaranteed deletion.Key areas to review
cmd/utils.go:2160-2188:unstackAndKeepLocalcentralizes the outcome handling. Check the merged-only versus blocked-remnant distinction, the404/API-error paths, and that remote ID/number clearing and the catalog save happen only after a safe outcome.cmd/utils.go:2141-2158:resolveDivergenceDeleteRemotedistinguishes lookup failure from a missing stack and delegates to the shared helper. It keeps sync stopped and only offers recreation guidance after the local association is safely cleared.cmd/checkout.go:627-631:handleCompositionConflictuses the same helper for its keep-local choice, returning the existing local stack rather than importing or replacing its branches.Related issues
Stack created with GitHub Stacks CLI • Give Feedback 💬