Detect Git Worktree opened in another VSCode instance

Resolved 💬 3 comments Opened Mar 11, 2026 by filaupe Closed May 10, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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?

  1. Create a Git worktree using VSCode (via Source Control).
  2. Open the worktree folder in a new VSCode window.
  3. Open Codex IDE on the same machine.
  4. Make changes in the project through Codex.
  5. 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" />

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 5 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #14182
  • #13627
  • #13146

Powered by Codex Action

etraut-openai contributor · 5 months ago

This isn't a supported feature. I'll change this from a bug report to a feature request.

etraut-openai contributor · 3 months ago

This feature request hasn't received enough upvotes, so I'm going to close it.