Skip to content

PRs not shown in panel when workspace folder is a manually-created git worktree #8756

@bkmuraliext

Description

@bkmuraliext

Extension version

0.144.0

VS Code version

1.110.1 (Windsurf)

OS

macOS Darwin 25.5.0

Steps to reproduce

  1. Have a repo at ~/workspace/github/web-controller with open PRs on a feature branch.
  2. Create a worktree manually:
    git -C ~/workspace/github/web-controller worktree add \
      ~/workspace/cascade-wt/feature-foo/web-controller \
      -b feature-foo origin/develop
    
  3. Open only the worktree directory (~/workspace/cascade-wt/feature-foo/web-controller) as a workspace folder in VS Code / Windsurf.
  4. Open the GitHub Pull Requests panel.

Expected behaviour

PRs for the repo (matched via the origin remote) are listed in the panel, just as they are when opening the main repo directory.

Actual behaviour

The GitHub Pull Requests panel shows no PRs and does not recognise the folder as a GitHub repo.

Root cause

A manually-created worktree directory contains a .git file (pointer), not a .git/ directory:

$ cat ~/workspace/cascade-wt/feature-foo/web-controller/.git
gitdir: /Users/me/workspace/github/web-controller/.git/worktrees/web-controller1

The remote configuration lives in the main repo's .git/config, reachable via the commondir pointer inside the worktree-specific git dir:

$ cat /Users/me/workspace/github/web-controller/.git/worktrees/web-controller1/commondir
../..

Git itself follows this chain correctly (git remote -v works from the worktree directory). However the extension's repo-discovery logic appears not to follow the .git file → commondir → main config chain, so it never finds the origin remote and renders no PRs.

Notes

  • The Source Control panel (VS Code's built-in git extension) does surface the correct branch and remote from the same worktree directory, confirming the pointer chain is valid.
  • Worktrees created by the extension ("Checkout Pull Request in Worktree") may work because the extension tracks those itself; the gap is with worktrees created externally via git worktree add.
  • Workaround: also add the main repo directory as a second workspace folder — the panel then finds the real .git/ and shows PRs correctly, but this results in the same files appearing twice in the Explorer.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions