Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Shared history-rewrite and publishing changes require human review, and base-handling defects remain unresolved.
4 open issues
What changed in this PR
Adds basic branching-stack support: independent linear stacks can depend on branches in other stacks without introducing tree-wide operations or changing storage and recovery formats.
Changes:
- Adds
add --forkand interactive mid-stack forking, including existing-branch adoption. - Prefers member-stack selection and guards destructive edits to locally known child-stack bases.
- Adds publishing checks, child-history repair, tests, and workflow documentation.
| File | Description |
|---|---|
skills/gh-stack/SKILL.md |
Documents fork commands, safeguards, and limitations. |
skills/gh-stack/references/stack-design.md |
Explains dependent-stack design and workflow. |
internal/stack/stack.go |
Adds member-first stack lookup. |
internal/stack/stack_test.go |
Tests lookup precedence and ambiguity. |
internal/github/github.go |
Includes base names in PR details. |
docs/src/content/docs/reference/cli.md |
Documents fork behavior and publishing requirements. |
docs/src/content/docs/guides/workflows.md |
Adds a dependent-stack workflow guide. |
docs/src/content/docs/faq.md |
Clarifies support for shared stack bases. |
cmd/worktree_utils.go |
Uses member-first lookup for navigation. |
cmd/view.go |
Updates stack selection and retarget warnings. |
cmd/view_test.go |
Tests shared bases and single-PR retarget display. |
cmd/utils.go |
Adds base discovery, validation, and rebase boundaries. |
cmd/utils_test.go |
Tests selection, discovery, and publication evidence. |
cmd/trunk_target_test.go |
Updates local-only trunk test setup. |
cmd/sync.go |
Integrates base evidence and rewritten-parent repair. |
cmd/sync_test.go |
Tests linked-parent repair and single-PR retargets. |
cmd/submit.go |
Adds member-first selection and base preflight. |
cmd/submit_test.go |
Tests publishing guards and shared-base selection. |
cmd/rebase.go |
Integrates base discovery and bottom-branch cutoffs. |
cmd/rebase_test.go |
Tests rewrite boundaries, retargets, and recovery. |
cmd/push.go |
Integrates member-first selection and base validation. |
cmd/push_test.go |
Tests shared-base selection and retarget protection. |
cmd/navigate_test.go |
Tests navigation through shared-base branches. |
cmd/modify.go |
Guards destructive edits to child-stack bases. |
cmd/modify_test.go |
Tests dependent-base action restrictions. |
cmd/merge.go |
Prefers the member stack during merge selection. |
cmd/merge_test.go |
Tests member-first remote-stack selection. |
cmd/init.go |
Points existing stack members toward add --fork. |
cmd/checkout.go |
Uses member-first lookup for branch targets. |
cmd/checkout_test.go |
Tests numeric member-branch resolution. |
cmd/add.go |
Implements explicit and prompted stack forks. |
cmd/add_test.go |
Tests fork creation, adoption, commits, and refusals. |
Review effort: Max
skarim
marked this pull request as draft
October 26, 2026 15:54
Collaborator
Author
|
Closing out this PR because it has gotten too large. Will break up and reopen as a stack. |
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.

Adds
gh stack add --forkto start an independent stack from the current branch, including a branch in another stack. Each stack remains linear, with no tree-wide operations or changes to storage and recovery formats.Functionality and user impact
add --forkstarts a new local stack. Mid-stackaddoffers to fork interactively; ordinary top-of-stackaddstill extends the stack.syncandrebasehandle rewritten parents and single-PR retargets using validated boundaries and the existing consent/recovery behavior.submitchecks non-default bases before pushing;modifyblocks renaming, dropping, or folding locally known child-stack bases. Closed single PRs with missing bases fail with guidance.Key areas to review
cmd/add.goandinternal/stack/stack.go: shared creation/adoption flow, bypassing the empty-layer commit shortcut for forks, and member-first resolution.cmd/utils.go: single-PR base discovery and publishing guards. Check closed-PR evidence before metadata refresh, and the distinction between local-only and deleted remote bases.bottomRebaseCutoff,cmd/rebase.go, andcmd/sync.go: for parent rewrites, gate bottom-branch--ontoon a valid recorded base while retaining ordinary rebase and recovery paths.cmd/modify.go: reject destructive fork-point changes beforeApplyPlan, without rewriting dependent stacks.Stack created with GitHub Stacks CLI • Give Feedback 💬