gitmyhub

git-worktree-watch

TypeScript ★ 1 updated 1mo ago

VS Code extension that refreshes Git worktrees created outside VS Code

A VS Code extension that automatically detects Git worktrees created outside of VS Code and registers them in the Source Control panel without requiring a window reload.

TypeScriptVS Code Extension APIGitsetup: easycomplexity 2/5

Git Worktree Refresh is a VS Code extension that solves a small but annoying problem: when you create a Git worktree outside of VS Code (say, from a terminal), VS Code doesn't automatically notice it exists. You'd have to reload the window or take extra steps to get it to show up in your Source Control panel. This extension fills that gap by watching for new worktrees and making sure they appear in VS Code without any manual intervention.

For context, a Git worktree is a way to have multiple branches of the same repository checked out in different folders at the same time, without cloning the repo over and over. It's handy when you need to quickly switch contexts — like jumping onto a bug fix without stashing your current work. The catch is that VS Code's built-in Git tooling doesn't always pick up on worktrees created externally, which is a known issue tracked by the VS Code team.

The extension works by keeping an eye on the hidden Git metadata files that get updated whenever a new worktree is created. When it detects a change, it tells VS Code's existing Git extension to scan for and register any worktrees it hasn't seen yet. There's also a manual command you can run if the automatic detection doesn't catch something, and you can tweak settings like how long it waits before rescanning or whether it shows notifications.

This would be most useful for developers who regularly use Git worktrees as part of their workflow but prefer creating them from the command line or scripts rather than through VS Code's interface. The project is explicitly labeled as a work-in-progress toy project, so it's early days — but it addresses a real pain point that VS Code hasn't fixed on its own yet.

One limitation worth noting: it only handles discovering new worktrees. If you remove a worktree, you're still relying on VS Code's built-in behavior to clean that up. It also won't modify your workspace files or bypass any of VS Code's security protections around trusted repositories.

Where it fits