-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Description
Problem
VS Code's Git extension allows users to manually close and open repositories via the Source Control panel context menu ("Close Repository" / "Open Repository"). However, these actions are not exposed as commands that can be invoked programmatically by extensions or tools.
Use Case
When working with multi-repository workspaces (common in enterprise environments with component-based architectures), users frequently clone repositories into the workspace for temporary work. After completing tasks, these repos clutter the Source Control panel even though they're no longer actively being worked on.
Current workaround: Users must manually right-click each repo and select "Close Repository".
Desired behavior: Extensions and tools (including AI assistants like GitHub Copilot) should be able to:
- Close inactive repositories to reduce clutter
- Reopen repositories when work resumes on them
Proposed Solution
Expose two new commands in the Git extension:
// Close a repository (remove from Source Control tracking, files remain on disk)
git.closeRepository: (repositoryPath: string) => void
// Open/reopen a repository (add to Source Control tracking)
git.openRepository: (repositoryPath: string) => voidBenefits
- Better multi-repo workspace management - Extensions can help manage repository visibility
- Improved AI assistant integration - Tools like Copilot could automatically close repos after completing work
- Workflow automation - Task runners could open/close repos as part of build or deployment workflows
- Consistency - Aligns with other Git commands that are already exposed (e.g.,
git.checkout,git.pull)
Additional Context
- The internal functionality already exists (the UI uses it)
- Similar to how
workbench.action.closeActiveEditoris exposed for editor management - Would complement existing
git.openRepositoryprompt behavior when opening files from closed repos