Copilot corrupting git worktrees
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Bug description
I am working with git worktrees on a remote.
At a couple of occasions I have asked Copilot to create a new git worktree for a job.
After that, several other worktrees have been disconnected from the git repo. The code has still been there, and the worktrees' .git files still point to /worktrees/, but those directories are gone.
## Investigation
I asked Copilot to investigate what had happened.
Because of sandboxing, and the worktrees being located under a different directory than the git repo, some git commands failed with error "not a git repository".
That made Copilot to believe that the repo was corrupt and tried to fix it by directly manipulating the structure under the git repo, thereby actually corrupting the worktrees.
## System information
- Copilot Chat Extension Version: 0.41 (2026-03-25)
- VS Code Version: 1.133
- OS Version: local 26.5.2 (25F84), remote Ubuntu Linux
- Feature: agent, git worktrees
- Selected model: auto
- Logs: -
Contributor guide
Assessment
This issue has not been assessed yet.