Skip to content

Support stacks across Git worktrees - #520

Draft
skarim wants to merge 1 commit into
mainfrom
skarim/worktrees-support
Draft

skarim wants to merge 1 commit into
mainfrom
skarim/worktrees-support

Conversation

@skarim

@skarim skarim commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Makes gh stack work with existing Git worktrees, whether they hold independent stacks or different layers of the same stack.

  • Share stack tracking across worktrees so moving a branch or removing a worktree no longer loses its stack. Migrate compatible existing state with backups; conflicting definitions require resolution rather than guessing.
  • Run rebase and sync in each affected branch's worktree, with dirty/busy checks, coordinated mutations, and conflict recovery that can be continued or aborted from another worktree.
  • Adopt branches already checked out elsewhere without moving them. Add --print-path for shell-assisted navigation, and preserve occupied branches during pruning.

Requires Git 2.36+. This adds compatibility with existing worktrees, not worktree creation/removal or automatic stashing. Distributed modify support follows in #521.

Related issues

@skarim
skarim added this pull request to stack #522 September 22, 2026 17:03

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant