Warn when selected folder resolves to a parent Git repository root
- Dominant language
- No language data
- Stars
- 2.1k
- Forks
- 153
- PR merge metrics
- No merged PRs in 30d
Description
### Feature summary
Warn users when a selected subfolder resolves to an (accidentally) initialized parent Git repo, causing Copilot to open the parent directory instead.
### What problem are you trying to solve?
When a user selects an empty or new folder that lives inside an existing Git repository, Copilot opens the parent repository root instead of the selected folder. This follows normal Git behavior, since the selected folder inherits the nearest parent `.git` directory, but the UX is surprising when the user does not realize the parent directory is a repository.
Example:
- User selects: `~/personal-projects/new-empty-folder`
- Parent repo exists at: `~/personal-projects/.git`
- Copilot opens session at: `~/personal-projects`
This can look like Copilot ignored the user’s folder selection. Honestly, this problem really only occurs if the user _forgets_ that the parent directory (`personal-projects`) was originally set up as a git repository...
### Proposed solution
When the selected folder resolves to a parent Git repository root that is different from the selected path, Copilot should explicitly acknowledge this before creating the session.
Suggested message:
> The folder you selected is inside an existing Git repository:
>
> Selected folder: `~/personal-projects/new-empty-folder`
> Repository root: `~/personal-projects`
>
> Copilot sessions are created at the repository root, so this session will open `~/personal-projects` instead.
### Workflow impact
This is especially confusing for common personal dev workflows where users keep many unrelated projects under a container directory like `~/personal-projects`, `~/code`, or `~/src`. If that container directory was _accidentally_ initialized as a Git repo, every new empty child folder appears to Copilot as part of the parent repo.
### Installation context
_No response_
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.