{{ repo_path }} — absolute path to the repository root (e.g., /Users/me/code/myproject. Or for bare repos, the bare directory itself)
{{ repo }} — repository directory name (e.g., myproject)
{{ owner }} — primary remote owner path (may include subgroups like group/subgroup)
{{ remote_repo }} — repository name in the primary remote URL, without .git (e.g., myproject); differs from {{ repo }}, the directory on disk, when a clone was renamed
{{ branch }} — raw branch name (e.g., feature/auth)
{{ branch | sanitize }} — filesystem-safe: / and \ become - (e.g., feature-auth)
Create ~/.codex/worktrunk-commit-instructions.txt containing just . (no newline). Accepting Worktrunk’s first-run Codex setup creates the file for you.
columns = ["branch", "status", "ci", "path"] # Columns to show, in order — built-ins or custom headers (omit for the default set)
timeout-ms = 0# Wall-clock budget for the entire collect phase; 0 disables
columns selects and orders the columns the wt list table and the wt switch
picker render; --format json ignores it and always emits every field. Omit it
for the default set. It is meant to drive a per-invocation
alias (wt --config-set 'list.columns=[…]' list),
giving a named view without disturbing the default wt list. A static setting
works but pins one layout over a table that otherwise adapts to --full and
terminal width.
Valid built-in names:
branch — The branch name
status — Git status symbols, plus any user-defined status
working-diff — Uncommitted line changes against HEAD, including untracked files (header @±)
ahead-behind — Commits ahead of and behind the default branch (header ^↕)
branch-diff — Line changes against the default branch (header ^…±)
summary — An LLM-generated summary of the branch
upstream — Commits ahead of and behind the upstream tracking branch (header Remote⇅)
ci — CI status of the head commit
path — The worktree’s path
url — Dev-server URL from the [list] url template
commit — The head commit’s short hash
age — Time since the last commit
message — The head commit’s subject
A selection mixes built-ins with custom columns, each named
by its [list.custom-columns] header (columns = ["branch", "Ticket", "ci"]),
and is exhaustive: only the listed columns render. Omit columns to keep the
default set, where custom columns append automatically.
Listing a column forces it on, space permitting: ci shows without --full. A
column whose data source is missing still stays hidden — summary needs an LLM
command ([commit.generation]), url needs a [list] url template.
Custom columns add per-branch context to the wt list table. Each
[list.custom-columns] entry is a column: the key is the header, the template
renders each row’s cell.
[list.custom-columns.Ticket]
template = "{{ vars.ticket }}"# Required; the result is the cell text
width = 20# Optional max display width (default: 40)
priority = 9# Optional drop order when the terminal narrows;
# lower = kept longer (default: 9, the URL band)
Templates may reference {{ branch }}, {{ worktree_path }},
{{ worktree_name }} (empty for branch-only rows), and two per-branch
namespaces:
{{ git.branch.* }} — the branch’s own git config under branch.<name>.*,
read straight from git config (e.g. {{ git.branch.jira }} for a key you
set yourself, or the git-native description). Git lowercases config variable
names, so branch.<name>.nvciShelf reads as {{ git.branch.nvcishelf }}.
All standard filters work (sanitize, hash_port, codename, …). A row
where the template renders empty (e.g. a branch without the key) shows an
empty cell; a column that is empty for every row is dropped from the table.
wt list --format json includes the rendered values under
items[].display.columns in schema 2, or under columns in schema 1.
A Jira column reading a key kept in git config, and a Summary column
showing just the first line of the git-native branch description:
[list.custom-columns.Jira]
template = "{{ git.branch.jira }}"
[list.custom-columns.Summary]
template = "{{ git.branch.description | lines | first }}"
Built-in excludes (VCS metadata and tool-state directories) always apply; the wt step copy-ignored docs list them. User config and project config exclusions are combined.
User config can include a [projects] table for project-specific settings — worktree layout, setting overrides, anything else — separate from the project config shared with teammates.
Entries are keyed by project identifier — <host>/<owner>/<repo> derived from the primary remote URL (no .git suffix; an explicit port other than SSH’s default 22 stays with the host, as in gitlab.example.com:2222/team/project), or the canonical repo path when there is no remote. Run wt config show inside the repo to see the identifier for the current project; it appears in the PROJECT CONFIG section as Identifier: ….
Scalar values (like worktree-path) replace the global value; everything else (hooks, aliases, etc.) appends, global first. See how the layers rank.
A key containing * matches any run of characters, / included, so one entry covers a whole host or namespace — including nested groups. * is the only wildcard; every other character, . among them, is literal.
# Every repository on a self-hosted forge whose hostname carries no brand
Every matching entry applies, least- to most-specific, following the rule above: a more specific entry — git.company.example/platform/* over git.company.example/* — wins where both set the same setting, while hooks and aliases from every matching entry all run, least-specific first. A literal key is the most specific of all; specificity is the count of non-* characters in the key. End a host-wide key with /* — a bare git.company.example* also covers hosts whose names merely start with that string. A remote on a non-default SSH port carries the port in its identifier, so its host-wide key is git.company.example:2222/*.
Entries in approvals.toml match the same way, so a hand-written pattern entry approves its commands for every repository it covers.
forge names the forge for the matched repositories — the user-level counterpart of the project config’s forge platform block, for a self-hosted host whose name carries no github, gitlab, or gitea for detection to read.
[projects."git.company.example/*"]
forge.platform = "gitlab"# or "github", "gitea" (experimental), "azure-devops" (experimental)
forge.hostname = "api.git.company.example"# API host, when the remote's own host isn't it
A repository’s own [forge] block still wins over any entry here, field by field.
Hooks support all three hook forms. A table runs multiple commands concurrently; an array-of-tables pipeline runs steps in sequence:
See wt hook for hook types, execution order, template variables, and examples. User hooks apply to all projects; project hooks apply only to that repository.
Project configuration lets teams share repository-specific settings — hooks, dev server URLs, and other defaults. The file lives in .config/wt.toml and is typically checked into version control.
To create a starter file with commented-out examples, run wt config create --project.
The forge is read from the remote’s hostname: any host carrying github, gitlab, or gitea anywhere in it, plus the Azure DevOps service domains. Name the forge explicitly for a host carrying none of those, such as a Forgejo instance at forge.example.com:
[forge]
platform = "github"# or "gitlab", "gitea" (experimental), "azure-devops" (experimental)
hostname = "github.example.com"# Example: API host (GHE / self-hosted GitLab)
When many repositories share one self-hosted host, name it once in user config with a pattern-keyed [projects] entry instead of repeating this block in each repo. A repository’s own [forge] still wins, field by field.
template-append adds project-wide conventions to the LLM commit and squash prompts, shared so every teammate’s LLM sees the same style guide:
[commit.generation]
template-append = """
- Use conventional commits (feat:, fix:, docs:, …)
- Reference the relevant issue ID in the body
"""
The first time the fragment is used (and whenever it changes), wt prompts the user to approve it — the same one-shot gate as project-defined hooks. Only template-append is honored from the project file; the LLM command and the main prompt template stay in user config. See the LLM commits guide for how the fragment renders.
Built-in excludes (VCS metadata and tool-state directories) always apply; the wt step copy-ignored docs list them. User config and project config exclusions are combined.
On first run without shell integration, Worktrunk offers to install it. On first commit without LLM configuration, it offers to configure a detected tool (claude, codex, opencode). Declining sets skip-shell-integration-prompt or skip-commit-generation-prompt automatically.
--config-set <toml> overrides any user config key for a single invocation. The value is a TOML fragment, so arrays and tables work directly; the flag is global (works before or after the subcommand), repeatable, and a later --config-set replaces an earlier one for the same key.
Sources closer to the invocation rank higher (user config above system config), and within a config file a project entry outranks the global key of the same name. So worktree-path comes from the first of these that sets it:
--config-set 'worktree-path = …'
WORKTRUNK_WORKTREE_PATH
[projects."github.com/owner/repo"] in the config file
global worktree-path in the config file
A --config-set that names a project entry is both the highest layer and the most specific key, so it beats the same flag’s global key:
For validation and completion in editors that support TOML schemas (such as Taplo or Tombi), start the file with #:schema https://worktrunk.dev/schema/user-config.json (user config) or #:schema https://worktrunk.dev/schema/project-config.json (project config).
A subprocess cannot change its parent shell’s directory. Shell integration defines a function that runs the Worktrunk binary, then changes the shell’s directory when the command requests it. It also enables tab completion.
Start a new shell after installation to load the wrapper. Invoke wt by name. Running a binary path or git wt bypasses the wrapper, so the shell’s directory stays unchanged.
The SHELL INTEGRATION section reports whether the wrapper is active in the current session. Installation and activation are separate: a configured shell can still be running without the wrapper until its config is reloaded.
In bash, zsh, or fish, type wt checks that wt resolves to a function. In PowerShell, Get-Command wt -All lists the Function and Application definitions.
For bash, fish, zsh, and PowerShell, add the matching line to the shell config. For Nushell, run the command to save the wrapper in its autoload directory.
Bash (~/.bashrc):
eval"$(wtconfigshellinitbash)"
Fish (~/.config/fish/config.fish):
wt config shell init fish | source
Zsh (~/.zshrc):
eval"$(wtconfigshellinitzsh)"
Nushell 0.113+ — save to vendor autoload directory:
Appends an initialization line to bash, zsh, and PowerShell config files. For fish and Nushell, it replaces the autoloaded wrapper file; fish also gets a separate completion file. See worktrunk.dev/shell-integration for their locations.
Uninstall recognizes the standalone setup lines written by Worktrunk or shown in wt config shell init --help, including older generated forms and custom binary names. Customized initialization lines must be removed manually.
Shows config sources and checks for invalid TOML or list columns, misplaced or
deprecated keys, and commands awaiting approval. It renders every section
before failing; warnings exit zero.
Updates deprecated settings in user and project config files
to their current equivalents, removes deprecated keys that have no equivalent,
and reports each one. Shows a diff and asks for confirmation.
Project hooks and project aliases prompt for approval on first run to prevent untrusted projects from running arbitrary commands. Approvals from both flows are stored together.
wt config approvals list reads the state without prompting or writing it, so an orchestrator can find out whether a non-interactive run will stop for approval before scheduling one. --format=json emits:
{
"state": "approval_required",
"commands": [
{"phase": "post-start", "name": "dev", "template": "npm run dev", "approved": false},
state is no_commands (the project declares none), approval_required (at least one is unapproved), or approved. name is absent for an unnamed command and for the commit-template fragment.
stale, which can accompany any state, lists approvals whose command has since been edited or removed from the project config.
Aliases are command templates configured in user (~/.config/worktrunk/config.toml) or project (.config/wt.toml) config and run as wt <name>. See the Extending Worktrunk guide for the configuration format.
Status explanations — explanations shown in the current wt list footer rotation
Hints — one-time hints already shown in this repo
Previous branch — the wt switch - target, re-recorded on the next switch
cache clear drops all of the above with no prompt. It re-shows one-time hints and forgets the wt switch - target until the next switch — both repopulate on their own.
Useful in scripts to avoid hardcoding main or master:
gitrebase $(wtconfigstatedefault-branch)
In a hook or alias template, prefer the {{ default_branch }}template variable; $(wt config state default-branch) is for plain shell scripts.
Without a subcommand, runs get. set stores the override in the repository’s local git config. The override adds no project file and applies to every linked worktree in the clone. clear then get re-detects. The branch must exist locally for wt list comparisons.
Git cache — Detects primary remote and checks its HEAD (e.g., origin/HEAD)
Remote query — If not cached, queries git ls-remote, giving up after 10s
Local inference — If no remote, or the query was abandoned, infers from local branches
Once detected, the result is cached in worktrunk.default-branch — except a value inferred after the remote query was abandoned, so an outage can’t make a guess permanent. A later change to origin/HEAD isn’t picked up automatically: wt config state flags the mismatch, set adopts the new branch, and clear re-detects.
The local inference fallback uses these heuristics in order:
If only one local branch exists, uses it
For bare repos or empty repos, checks symbolic-ref HEAD
Checks git config init.defaultBranch
Looks for common names: main, master, develop, trunk
If none of these match, detection fails; set it explicitly with wt config state default-branch set BRANCH.
wt config state default-branch — Command reference
Hook output lives in per-branch subtrees under .git/wt/logs/{branch}/:
Operation
Log path
Background hooks
{branch}/{source}/{hook-type}/{name}.log
Background removal
{branch}/internal/remove.log
All post-* hooks (post-start, post-switch, post-commit, post-merge, post-remove) run in the background and produce log files. Source is user or project. Branch and hook names are sanitized for filesystem safety. Same operation on same branch overwrites the previous log. Removing a branch clears its subtree; orphans from deleted branches can be swept with wt config state logs clear.
trace.log is the human-readable trace of commands and their timings. trace.jsonl holds the same events as JSON lines, which wt config state logs profile summarizes into a performance report. subprocess.log holds full subprocess output. diagnostic.md is a bug-report bundle; wt prints a gh gist create command for it. All four are overwritten on each -vv run.
wt config state logs --format=json emits three arrays — command_log, hook_output, diagnostic. Each entry carries a file (relative), path (absolute), size, and modified_at (unix seconds). Hook-output entries additionally expose branch, source (user / project / internal), hook_type (the post-* kind, or null for internal ops), and name. branch is the branch name, or null when no local branch writes to that log directory (e.g. the branch was deleted). name is the hook name as it appears in the log path, which differs from the configured name only when that contains characters unsafe in a filename. Filter with jq to pick out a specific entry.
When wt deletes a branch or wt switch --create creates one, it clears that branch’s marker. A branch deleted and recreated with plain git keeps its marker until wt config state marker clear.
Without a subcommand, runs get for the current branch. For --branch, use get --branch=NAME.
Stored in git config as worktrunk.state.<branch>.vars.<key>. Keys start with a lowercase letter and contain only lowercase letters, digits, and hyphens.
wt config state vars - Custom variables per branch
Usage:wt config state vars[OPTIONS]<COMMAND>
Commands:
get Get a value
list List all keys
set Set a value
clear Clear a key or all keys
Options:
-h, --help
Print help (see a summary with '-h')
You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.