🧩 VS Code Git WorktreesA wrapper for Git Worktree operations that provides an interactive API so developers can manage worktrees more easily — without switching between the terminal and VS Code. 🎯 Purpose of the ExtensionAfter creating a ZSH plugin for Git operations, I noticed how often I switched between the terminal and my main editor (VS Code). To streamline my workflow, I built this extension to keep everything inside VS Code. ⚙️ Requirements
🧪 Multiple Workspaces SupportThis extension supports multiple workspaces. Here's how it works:
✅ Select a workspace from the list → the operation will run in that workspace. 🛠️ Supported Operations➕
|
🏷️ Property | 🧩 Type | 🛠️ Default | 📃 Description |
---|---|---|---|
vsCodeGitWorktrees.remove.stalledBranches |
boolean |
false |
Remove local (stalled) branches that no longer exist on the remote |
vsCodeGitWorktrees.move.openNewVscodeWindow |
boolean |
true |
Open a new VS Code window when switching or creating a worktree |
vsCodeGitWorktrees.worktrees.dir.path |
string |
null |
Define a directory for storing all your worktrees |
vsCodeGitWorktrees.add.autoPush |
boolean |
true |
Automatically push the new worktree branch after creation |
vsCodeGitWorktrees.add.autoPull |
boolean |
true |
Automatically pull updates after creating a new worktree branch |
vsCodeGitWorktrees.worktreeCopyIncludePatterns |
array |
[] |
Files and folders to copy from the source repo to the new worktree |
vsCodeGitWorktrees.worktreeCopyExcludePatterns |
array |
[] |
Files and folders to exclude from the worktree copy |
vsCodeGitWorktrees.worktree.coloring |
boolean |
false |
Enable color labels when creating or switching worktrees |
vsCodeGitWorktrees.worktreeSearchPath |
string |
null |
Optional subdirectory (relative or absolute) where Git repositories can be found if the root workspace is not a Git repository |
💡 How You Can Contribute
Whether it’s your first time contributing or you're a seasoned open-source developer, you're welcome here! Here are some great ways to get involved:
📚 Improve the Documentation – Typos, clarity, or better examples? We’d love your help!
✅ Write Tests – Help us make sure everything works smoothly.
📢 Share the Project – Tell your friends or tweet about it!
⭐️ Star the Repository – A small gesture that means a lot.
📋 Check Out the TODO List – Grab a task and dive in!
🐛 Report a Bug – Found something odd? Open an issue and let us know. To help us investigate faster, you can enable debug logging before reproducing the issue:
Open Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
on macOS)Enable logs by running:
Git Worktree: Toggle Logger Output
Reproduce the issue(Add/Remove/List).
Copy the relevant log lines.
Attach them to your GitHub issue to help us troubleshoot.
🚀 Want to Contribute Code?
Awesome! Here’s a quick guide to get started:
- Fork the Project Click the Fork button at the top right of the repository.
- Clone Your Fork
git clone https://github.com/your-username/vscode-git-worktrees.git
cd vscode-git-worktrees
- Make Your Changes Work your magic — whether it’s a new feature, a fix, or docs improvement.
- Open a Pull Request Go to the original repository and click Compare & pull request. Add a helpful description and submit!
🛠️ Run the Extension Locally
Want to test or develop the extension on your machine? Here’s how:
# Install dependencies
yarn
# Compile the code and watch for changes
yarn watch
Then, open the project in Visual Studio Code, press F5, and it will launch in a new Extension Development Host window.
To enable detailed logging:
Open Command Palette (
Ctrl+Shift+P
orCmd+Shift+P
on macOS)Enable logs by running:
Git Worktree: Toggle Logger Output
When running locally this way, logs will appear in the Output Console, helping you trace the extension’s behavior in real time.