Repository navigation
Put a new stack in the worktree's own stack file - #49
Merged
Merged
Conversation
Running git stack init in a linked worktree that didn't have a stack file yet wrote the new stack into the main checkout's file. git-stack reads every worktree's file so it all looked fine, but gh stack only reads the file in the git dir it runs in, so from that worktree submit said the branch wasn't in a stack. Anything else that starts a new stack the same way (move onto a trunk) hit it too. New stacks now always go in the current worktree's file, creating it if need be, and that's the git dir we lock while writing. From the main checkout nothing changes, since its git dir is the common one.
DomBlack
force-pushed
the
dom/new-stack-in-worktree-file
branch
from
October 16, 2026 12:18
adc55fb to
1938ee0
Compare
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.
gh stack keeps a separate stack file per worktree and only ever reads the one for the worktree it runs in. When git stack init (or a move onto a trunk) started a new stack in a linked worktree that didn't have a file yet, we wrote it into the main checkout's file instead. git-stack reads every worktree's file so view and sync looked fine, but submit from that worktree failed with "current branch is not part of a stack". That's how I hit it submitting #48.
New stacks now always go in the current worktree's file, creating it if need be, and that's the git dir we lock while writing. From the main checkout nothing changes, since its git dir is the common one.