brew tap krystxf/wtw
brew install wtwCreate ~/.config/worktree-workflow/config.json:
{
"editor": "cursor",
"auto_open_editor": true,
"naming": {
"worktree_dir_suffix": "--worktrees",
"branch_separator": "--"
}
}| Field | Default | Description |
|---|---|---|
editor |
"cursor" |
Command to open the worktree (e.g. code, nvim, zed) |
auto_open_editor |
true |
Open editor automatically after creating a worktree |
naming.worktree_dir_suffix |
"--worktrees" |
Suffix for the parent worktree directory |
naming.branch_separator |
"--" |
Separator between repo name and branch name |
All fields are optional — missing values use the defaults above.
Create .worktree-workflow.json in your project root:
{
"sync_ignored": true,
"sync_excludes": ["node_modules"],
"post_copy_hooks": ["npm install"]
}| Field | Default | Description |
|---|---|---|
sync_ignored |
true |
Sync gitignored files (.env, etc.) via hard links |
sync_excludes |
[] |
Patterns to exclude from sync |
post_copy_hooks |
[] |
Shell commands to run in the new worktree after creation |
See the examples/ directory:
cursor-npm— Cursor editor +npm installtmux— tmux window per worktree
- Go 1.21+
- git
- rsync (pre-installed on macOS/Linux)
git clone https://github.com/krystof/worktree-workflow.git
cd worktree-workflow
go build -o wtw .This produces a wtw binary in the current directory.
# Create a worktree
./wtw create feature-branch
# List worktrees (interactive picker)
./wtw ls
# Remove a worktree
./wtw rm feature-branch# Build
make build
# Format code
make fmt
# Lint (requires golangci-lint)
make lint
# Clean binary
make cleanTests run inside a Docker container to ensure a consistent, isolated environment.
Prerequisites: Docker
make e2e-dockerThis builds the binary inside the container, runs all tests, and prints a colored summary at the end.
brew install golangci-lintOr see golangci-lint.run for other methods.