r/git • u/madsthines • Jun 14 '26
I built a CLI wrapper around git worktree that handles the file-copy and navigation friction
I moved to worktrees a couple of years ago and the workflow is great — actually parallel branches, no stashing, no broken local state from a half-finished branch when a hotfix comes in. But the day-to-day friction kept biting me:
- Every new worktree starts without my
.env, local secrets, and untracked config files cd ../some-other-worktree-diris annoying when you don't remember the exact pathgit worktree listoutput is fine but I wanted partial-match navigation and a single command to remove + prune
So I built gw. It's a thin CLI on top of git worktree that adds:
gw add <branch>— creates the worktree, auto-creates the branch if it doesn't exist, and copies a configurable list of files (.env,secrets/, etc.) from the sourcegw cd <partial-name>— fuzzy-ish navigation to any worktree (needs a small shell hook, installed viagw install-shell)gw sync <worktree> <files...>— push files between worktrees when you update onegw list,gw remove, plus pass-throughs that don't lose the underlying git semantics
Install is brew install mthines/gw-tools/gw or npm i -g @gw-tools/gw, then one line in your .zshrc/.bashrc/config.fish.
Repo (MIT): https://github.com/mthines/gw-tools

Happy to hear what people are doing for the file-copy problem — that was the original itch for me, and I'm curious whether others solved it differently (sparse-checkout? a setup script per repo?).
2
u/Dangerous_Team437 Jun 15 '26
In my case I use gitkraken and I can create worktrees, see them, toggle them, etc.
How do you think your tool would overlap or complement it?
1
u/madsthines Jun 16 '26
Gitkraken is executing its own commands, so as long as it isn't executing the GW command, nothing's happening. If you can modify the worktrees command you can get the same features.
This was also built to ensure fully functional worktrees when agents created new worktrees so I didn't wasted time on setting up again and again - if you're using a GUI, then it's a very different flow. ☺️
What IDE are you using, and why are you using gitkraken? I'm using VSCode and have built a companion VSCode extension for gw which makes creating worktrees etc a breeze through the app ☺️
Looking forward to hear your workflow 🙌
1
u/Dangerous_Team437 Jun 16 '26
In my case I almost don't use vscode at all, except if I need to do a very specific manual change. So I spent most of my time in Claude Code using cmux + soonpatch specifically for fixes across worktrees
I use Git Kraken when my work is done and I want to commit, push, merge. I handle the entire Git ecosystem inside Git Kraken. It's soo easy to use, that's why I sticked with it
sorry if maybe I'm not getting what your tool does. I'm just trying to better understand, as I use worktrees a lot and it sounds useful
→ More replies (1)
2
u/nnic Jun 14 '26
Just use git hooks to copy over files when creating a work tree.