A small shell tool for managing git worktrees. Built for running multiple Claude Code sessions on the same repo without them stepping on each other, but useful for any parallel-branch workflow.
Git worktrees let you have multiple working copies of a repo, each on its own branch, sharing the same .git history. cwt wraps that with short names, auto-branching, and an fzf picker so you don't have to think about paths.
~/code/myrepo ← your repo
~/code/myrepo.wt-feature ← cwt add feature
~/code/myrepo.wt-hotfix ← cwt add hotfix
~/code/myrepo.wt-1 ← cwt add (auto-named)
Each worktree gets its own branch (wt/feature, wt/hotfix, wt/1), a symlink to .claude/ from the main repo (so all sessions share config), and copies of .env* files.
git clone https://github.com/agladky/cwt.git
cp cwt/functions/cwt.fish ~/.config/fish/functions/
cp cwt/completions/cwt.fish ~/.config/fish/completions/Add to your ~/.bashrc:
source /path/to/cwt/cwt.sh
source /path/to/cwt/completions/cwt.bashAdd to your ~/.zshrc:
source /path/to/cwt/cwt.sh
fpath=(/path/to/cwt/completions $fpath)
autoload -Uz compinit && compinitOr source completions directly:
source /path/to/cwt/cwt.sh
source /path/to/cwt/completions/cwt.zshNo dependencies beyond git. fzf is optional but recommended for the worktree picker.
cwt add feature # create worktree, cd into it
cwt add # auto-named (1, 2, 3...)
cwt add -b my-branch # custom branch name instead of wt/feature
cwt add -s develop # branch off a specific commit/branch
cwt add hotfix -p # print path only, don't cd (for scripting)
cwt ls # list worktrees, * marks current
cwt go feature # cd into a worktree
cwt go # fzf picker
cwt # same as cwt go
cwt merge feature # merge wt/feature into current branch
cwt merge feature --squash # squash merge
cwt rm feature # remove worktree + branch (checks for dirty state)
cwt rm feature -f # force removestdout only ever gets machine-readable data (paths from add -p, lines from ls). Everything else goes to stderr. So you can do things like:
# fish
set p (cwt add hotfix -p)
cd (cwt add experiment -p)# bash / zsh
p=$(cwt add hotfix -p)
cd "$(cwt add experiment -p)"cd ~/code/myproject
cwt add billing-fix # creates worktree, switches to it
# ... work, commit ...
cwt go main # back to main branch
cwt merge billing-fix --squash
git commit -m "fix billing calculation"
cwt rm billing-fix # clean up- Worktrees are siblings of your repo dir with a
.wt-NAMEsuffix - Branches are auto-created under
wt/namespace .claude/gets symlinked so Claude Code config is shared across worktrees.env*files are copied (not linked, since they're gitignored)cwt rmchecks for uncommitted changes and unmerged commits before deleting- Stale worktree entries are auto-pruned on
add,ls, andrm - Works from inside any worktree (resolves the main repo via
git rev-parse --git-common-dir) - Tab completions for all subcommands, flags, and worktree names
MIT