You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh stack keeps its stack record per worktree, so a stack created elsewhere is reported as absent #653
gh stack keeps its stack record per worktree, and the CLI reports a stack created elsewhere as absent rather than as belonging to another checkout. A stack created in one worktree of a repository does not exist in a second worktree of the same repository: there, gh stack view prints not part of a stack and gh stack add <branch> refuses, even when one chain on GitHub contains both branches.
Extension works only from the worktree that created the stack, which is also the only place gh stack add accepts a branch another worktree has checked out. A reader, and gh pr merge, follow the pull request bases rather than the local record, so the chain holds even when the record is missing.
The skill would help if it stated that the record is per worktree, and that each pull request's base defines the chain when every layer has its own worktree.
The text below is the documentation addition a user wrote locally for this skill. It appears here verbatim, so it can be reviewed on its own terms.
## Stacks across git worktrees`gh stack` records stack membership per worktree, so a stack created in `~/Source/repo/layer-a` does
not exist in `~/Source/repo/layer-b`. There, `gh stack view` prints `not part of a stack` and
`gh stack add <branch>` refuses the same way, even when one chain on GitHub contains both branches.
Extend the stack from the worktree that created it, which is also the only worktree where
`gh stack add` accepts a branch that another worktree already checked out:
```bashcd~/Source/repo/layer-a # the worktree that owns the stack
gh stack add layer-b # adopted, together with the PR it already has
gh stack view --json
```
What defines the chain for a reader and for `gh pr merge` is the pull request base: GitHub bases
each PR on the branch below it. With one worktree per layer, create the PRs with an explicit
`--base <lower branch>` and treat the local stack record as bookkeeping rather than as the chain
itself, so a stack the CLI cannot see is still a stack the repository has.
- Stack membership belongs to one worktree; another worktree of the same repository cannot view or
extend it. Each PR's base defines the chain regardless.
Activity