treeist is a Git worktree helper.
The project/package name is Treeist, and the command you run is wt.
- Creates or reuses worktrees from branch names.
- Optionally auto-switches your shell directory after command execution.
- Supports interactive TUI pickers for switching and cleanup.
- Supports global/project config, environment overrides, and CLI overrides.
- .NET 10 SDK
- Git
./install-global-tool.shAfter install, run:
wt --helpdotnet run --project src/Treeist.Cli -- --helpAdd this to your shell config (~/.bashrc or ~/.zshrc):
eval "$(wt init zsh)"This allows wt to print the target directory and have your shell function cd there.
To disable auto-switch behavior:
eval "$(wt init zsh --no-switch-directory)"Or set:
export TREEIST_NO_SWITCH_DIRECTORY=1wt # list worktrees
wt <branch> # create or switch to branch worktree
wt switch # open switch picker
wt cleanup # open cleanup pickerwt [branch] [options]Global options:
--dir <dir>: target directory for a new worktree.--from <ref>: base branch/commit when creating a new branch.--branch-prefix <prefix>: prefix template for branch names.--copyignored: copy ignored files into newly created worktree.--copyuntracked: copy untracked files into newly created worktree.--copymodified: copy modified files into newly created worktree.--nocopy <pattern...>: glob patterns to skip while copying.
wt ls(list,ll): list worktrees.wt switch [branch]: switch/create a worktree (opens TUI when branch omitted).wt cleanup [worktrees...] [--mode interactive|merged|remoteless|all] [--dry-run] [--force] [-y|--yes]wt init <bash|zsh> [--no-switch-directory]
Configuration precedence (lowest to highest):
- Built-in defaults
- Global config file
- Project config file
- Environment variables
- CLI options
- Linux:
~/.config/treeist/config.toml(or$XDG_CONFIG_HOME/treeist/config.toml) - macOS:
~/Library/Application Support/treeist/config.toml - Windows:
%APPDATA%\\treeist\\config.toml - Project local:
<repo>/.treeist.toml
[worktree]
# Default: "../{repo_name}-worktrees/{branch}"
directory_pattern = "../{repo_name}-worktrees/{branch}"
branch_prefix = ""
auto_fetch = true
[copy]
copyignored = false
copyuntracked = false
copymodified = false
nocopy = [".env*", "*.local"]
[cleanup]
# interactive | merged | remoteless | all
default_mode = "interactive"{repo_dir}: absolute repo root path{repo_name}: repo directory name{repo_parent_dir}: parent directory of repo root{branch}: normalized branch segment (/,\\, spaces,_->-, lowercase)
TREEIST_WORKTREE_DIRECTORY_PATTERNTREEIST_WORKTREE_BRANCH_PREFIXTREEIST_WORKTREE_AUTO_FETCHTREEIST_COPY_COPYIGNOREDTREEIST_COPY_COPYUNTRACKEDTREEIST_COPY_COPYMODIFIEDTREEIST_COPY_NOCOPYTREEIST_CLEANUP_DEFAULT_MODETREEIST_TERMINAL_MODETREEIST_TERMINAL_ALWAYS_NEWTREEIST_TERMINAL_PROGRAMTREEIST_NO_SWITCH_DIRECTORY
dotnet restore treeist.sln
dotnet build treeist.sln
dotnet test treeist.sln
dotnet pack src/Treeist.Cli -c Release