A small, friendly Git worktree manager for everyday use.
- Create new worktrees quickly (or jump to existing ones)
- List existing worktrees
- Remove worktrees safely
- Print a worktree path for
cd "$(terris <branch>)" - Simplify workflows with autonomous agents that work in the terminal in the same repository
From crates.io:
cargo install terrisFrom source:
git clone https://github.com/mfornet/terris.git
cd terris
cargo install --path .# Jump to a worktree.
cd "$(terris feature-a)"
# List worktrees
terris
# List all worktrees (including detached)
terris --all
# Delete a worktree
terris --rm feature-aterris <branch>creates the worktree and prints the path every time.terrislists worktrees for the current repository.terris --alllists all worktrees, including ones without branches.- If the branch exists, it is used directly.
- If the branch does not exist, behavior depends on your terris config.
- Default path is
~/.terris-worktrees/<repo-name>/<branch>-<random-key>.
- Works from any directory inside a git repo.
- The tool shells out to
git, sogitmust be installed and available inPATH.
terris reads configuration from these files, in this order:
~/.terris/terris.tomlfor user-wide defaults<git-root>/.terris.tomlfor project-specific overrides
If both files exist, terris merges them and the project-local file overrides the global one. If neither exists, built-in defaults are used.
Create a global config:
mkdir -p ~/.terris
$EDITOR ~/.terris/terris.tomlCreate a project-local config:
$EDITOR .terris.tomlExample:
[worktrees]
base_dir = "~/src/worktrees"
use_random_suffix = true
suffix_length = 8
[behavior]
on_missing_branch = "fetch, create"
auto_prune = true
[display]
show_head = truebase_dir: Base directory for new worktrees. Supports~. Default:~/.terris-worktreesuse_random_suffix: Whether to append a random suffix to worktree directory names. Default:truesuffix_length: Length of the random suffix whenuse_random_suffix = true. Default:8. Valid range:1..=64
With defaults, terris creates worktrees under:
~/.terris-worktrees/<repo-name>/<branch>-<random-key>
If use_random_suffix = false, the path becomes:
~/.terris-worktrees/<repo-name>/<branch>
on_missing_branch: What terris should do when the requested branch does not exist locally. Default:"error"auto_prune: Rungit worktree prunebefore listing worktrees. Default:false
on_missing_branch accepts a comma-separated list of actions tried in order:
error: Fail immediately. This cannot be combined with other actions.fetch: Rungit fetch origin <branch>and use the remote branch if found.create: Create a new local branch from the currentHEAD.
Examples:
[behavior]
on_missing_branch = "error"[behavior]
on_missing_branch = "fetch"[behavior]
on_missing_branch = "fetch, create"[behavior]
on_missing_branch = "create"show_head: Show the shortHEADcommit hash as an extra column when listing worktrees. Default:false
Generate a completion script and source it in your shell:
# Bash
terris --completions bash > /tmp/terris.bash
source /tmp/terris.bash
# Zsh
terris --completions zsh > /tmp/_terris
fpath=(/tmp $fpath)
autoload -U compinit && compinit
# Fish
terris --completions fish > /tmp/terris.fish
source /tmp/terris.fishInstall permanently (recommended):
# Bash (user-level)
mkdir -p ~/.local/share/bash-completion/completions
terris --completions bash > ~/.local/share/bash-completion/completions/terris
# Bash (system-wide)
sudo mkdir -p /etc/bash_completion.d
sudo terris --completions bash > /etc/bash_completion.d/terris
# Zsh
mkdir -p ~/.zsh/completions
terris --completions zsh > ~/.zsh/completions/_terris
fpath=(~/.zsh/completions $fpath)
autoload -U compinit && compinit
# Fish
mkdir -p ~/.config/fish/completions
terris --completions fish > ~/.config/fish/completions/terris.fishThe project is named after the Terris people, responsible for preserving the knowledge of the civilization.
MIT