wtg
wtg manages feature branches that span multiple repos. When a feature touches several repos at once, wtg checks out a shared branch across all of them as git worktrees and wires them together with a go.work file — giving you an isolated, ready-to-build workspace per feature without cloning anything new.
New to worktrees? The GitKraken worktree guide is a good primer.
Installation
go install github.com/geoffamey/wtg@latest
Shell completions
bash — add to ~/.bashrc:
source <(wtg completion bash)
wcd() { cd "$(wtg path "$1")"; }
_wcd_completion() {
local cur="${COMP_WORDS[COMP_CWORD]}"
local opts
opts=$(wtg path --generate-shell-completion 2>/dev/null | cut -d: -f1)
COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
}
complete -F _wcd_completion wcd
zsh — add to ~/.zshrc:
source <(wtg completion zsh)
wcd() { cd "$(wtg path "$1")"; }
fish — add to ~/.config/fish/conf.d/wtg.fish:
if status is-interactive
wtg completion fish | source
function wcd
cd (wtg path $argv[1])
end
complete -c wcd -f -a '(wtg path --generate-shell-completion 2>/dev/null)'
end
wcd <workspace> is a shell helper that cds into the workspace root. Since
cd must run in the current shell it can't be a standalone command. The fish
complete line gives wcd the same workspace-name tab completion as wtg path.
Coding-agent plugins
This repo is a plugin marketplace for both Claude Code and Codex. Both plugins use the
same wtg-setup and wtg skills from this repository.
For Claude Code:
/plugin marketplace add geoffamey/wtg
/plugin install wtg@wtg
Use /plugin to manage or update it later.
For Codex:
codex plugin marketplace add geoffamey/wtg
codex plugin add wtg@wtg
To refresh the Codex marketplace and reinstall the current plugin version:
codex plugin marketplace upgrade wtg
codex plugin add wtg@wtg
Start a new Claude Code or Codex session after installing or updating so the refreshed
skills are available.
Configuration
Run wtg config init to scaffold a commented config file at
~/.config/wtg/config.toml:
wtg config init
It writes every setting commented out with its default; uncomment and edit the
lines you want to override. wtg config prints the resolved file, and
wtg config path prints its path. A minimal config looks like:
[discovery]
root_dir = "~/repos" # where wtg scans for git repos
max_depth = 2
[spaces]
root_dir = "~/workspaces" # where workspaces are created
[git]
branch_prefix = "" # prepended to workspace names, e.g. "yourname/"
YAML is still accepted: a file ending in .yaml/.yml loads via its extension,
so an existing config.yaml keeps working.
discovery.root_dir should contain your regular repo clones, each sitting on
their default branch (main, master, etc.) and otherwise left untouched.
wtg creates worktrees alongside them — it never modifies the main clones.
Override with --config <path> or the WTG_CONFIG environment variable.
Always-included repos, files, and hooks
The optional always section applies the same setup to every new space:
[always]
repos = ["shared-tooling"] # symlinked into every new space
files = ["~/.config/wtg/CLAUDE.md"] # copied into every new space root
secrets = [".env"] # copied into each worktree when present in the source repo
run = "~/.config/wtg/on-event" # executable run after create/add/remove/delete
always.repos symlinks shared repos in (no feature-branch worktree),
always.files seeds template files into the space root, always.secrets
copies listed local files from each source repo into its worktree when present,
and always.run invokes a hook script on space lifecycle events with the space
context in WTG_* environment variables. See docs/always.md
for the full behaviour, the event/variable reference, and examples.
Quick start
# Create a workspace for a new feature across three repos
wtg new my-feature api payments frontend
# Jump in
wcd my-feature
# ... do your work, then clean up
wtg delete my-feature --delete-branch
Workspace commands
wtg new <workspace> <repo>...
Create a workspace. At least one repo must be specified. For each repo, wtg
creates or checks out a branch named <branch_prefix><workspace> as a linked
worktree. A go.work file is written automatically for repos that have a
go.mod. Paths listed in always.secrets are copied from each source repo into
its worktree when present (see docs/always.md).
wtg new my-feature api payments frontend
wtg new my-feature api --branch yourname/main # check out an existing branch
Branch behaviour per repo: