Detect Git Worktree opened in another VSCode instance
What version of the IDE extension are you using?
26.5309.21912
What subscription do you have?
plus
Which IDE are you using?
VS Code
What platform is your computer?
x64
What issue are you seeing?
When using Git Worktrees created directly through VSCode, the Codex IDE does not correctly detect that I am working inside a specific worktree.
Even when the worktree folder is opened in another VSCode instance, Codex applies the changes to the repository's main branch instead of the branch associated with the worktree.
This results in unintended modifications being made to the main branch.
What steps can reproduce the bug?
- Create a Git worktree using VSCode (via Source Control).
- Open the worktree folder in a new VSCode window.
- Open Codex IDE on the same machine.
- Make changes in the project through Codex.
- Observe that the changes are applied to the main branch of the main repository instead of the worktree branch.
What is the expected behavior?
Codex IDE should detect that the opened directory belongs to a Git Worktree and apply changes to the branch associated with that worktree, rather than the main branch of the main repository.
Additional information
I am using the following VSCode settings:
SCM › Repositories: Explorer
SCM › Repositories: Selection Mode set to single
The worktrees are created directly from VSCode.
<img width="411" height="154" alt="Image" src="https://github.com/user-attachments/assets/8cedb127-c723-4fbd-815e-10914a23b19a" />
<img width="237" height="194" alt="Image" src="https://github.com/user-attachments/assets/459115d0-4463-43ab-bbb1-09ab33a0f912" />
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗