Skip to content

Add worktree awareness to PR checkout#12

Open
nchudleigh wants to merge 1 commit into
mainfrom
worktree-aware-checkout
Open

Add worktree awareness to PR checkout#12
nchudleigh wants to merge 1 commit into
mainfrom
worktree-aware-checkout

Conversation

@nchudleigh

Copy link
Copy Markdown
Contributor

Summary

  • Before running gh pr checkout, check if the PR's branch is already checked out in a git worktree
  • If a matching worktree is found, skip the checkout and cd directly to that path instead
  • Uses git worktree list --porcelain to find worktrees by branch name

Test plan

  • Select a PR whose branch is checked out in a worktree — should print "Branch '...' already checked out at ..." and cd there
  • Select a PR with no existing worktree — should behave as before

If the PR's branch is already checked out in a git worktree, cd there
instead of running gh pr checkout again.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants