See LLM-generated commit messages for configuration and prompt customization. Without a [commit.generation] command configured, the commit still happens — the message is built from the staged file names instead (Changes to README.md).
pre-commit hooks run before the commit and abort it on failure; post-commit hooks run after it, in the background with their output logged. --no-hooks skips both. See wt hook.
Render the prompt, print the LLM command, generate the message, and exit without staging, running hooks, or committing:
wtstepcommit--dry-run
Three sections are printed: the rendered prompt, the shell command that would invoke the LLM, and the message returned. The LLM call still happens — only the commit is skipped.
Squash commits since branching. Stages changes and generates message with LLM.
See LLM-generated commit messages for configuration and prompt customization. Without a [commit.generation] command configured, the squash still happens — the message lists the squashed commits’ subjects under Squash commits from <branch> instead.
pre-commit hooks run before the squash commit and abort it on failure; post-commit hooks run after it, in the background with their output logged. --no-hooks skips both. See wt hook.
The squash commit is made on a detached HEAD, as git rebase does, so git’s own commit hooks run and see no current branch.
Before squashing, Worktrunk saves the uncommitted changes the squash includes (everything staged, by hand or by --stage) to refs/wt-backup/<branch>. Changes left out of the squash stay in the working tree and aren’t backed up.
The output prints a command to recover the saved changes in a new worktree, including after wt merge removes the original.
Render the prompt, print the LLM command, generate the squash message, and exit without staging, running hooks, or squashing:
wtstepsquash--dry-run
Three sections are printed: the rendered prompt, the shell command that would invoke the LLM, and the message returned. The LLM call still happens — only the squash is skipped.
A rebase puts the branch’s commits on top of the target, which is what wt step push needs — a push fast-forwards only if the target is an ancestor of the branch. wt merge runs this step as part of its pipeline; on its own it brings a branch up to date with a target that has moved, without merging into it.
A conflicting commit leaves the rebase open rather than undoing it. The worktree keeps git’s conflict markers, and the ways out are git rebase --continue once the conflict is resolved, git rebase --skip, or git rebase --abort. Until the rebase is settled, wt step rebase, wt step squash, wt step push, and wt merge refuse to run.
Despite the name, no commits leave the repository. The target branch’s ref moves forward locally, and a worktree holding that branch is updated along with it. Publishing is a separate git push to the remote afterward.
The target is a branch, and must already be an ancestor of the current branch. One that has moved ahead is refused, and there is no force variant — wt step rebase puts the branch back on top of it first.
When the target branch has a worktree of its own, that worktree’s files move to the new commits too. Uncommitted changes there never move: the update carries any file the push doesn’t touch — staged or not — exactly where it is, and a change touching a file the push does change is refused upfront, naming the file. If the update can’t be applied, it is rolled back, leaving branch and worktree as they were.
By default the copy runs from the primary worktree into the current one — what a post-start hook needs, since the new worktree is where the hook runs. --from and --to name either end by branch, so a copy can run between two worktrees from anywhere:
wtstepcopy-ignored--frommain--tofeature# between two named worktrees
wtstepcopy-ignored--fromfeature# from feature into the current worktree
A branch named by --from or --to must have a worktree.
All gitignored files are copied by default, except for built-in excluded directories: VCS metadata (.bzr/, .hg/, .jj/, .pijul/, .sl/, .svn/), tool-state (.conductor/, .entire/, .worktrees/), and nested worktrees. Tracked files are never touched. Discovery handles nested .gitignore files, global excludes, and .git/info/exclude. Existing files in the destination are skipped, so re-running is safe; --force overwrites them.
To limit what gets copied further, create .worktreeinclude with gitignore-style patterns. Files must be both gitignored and in .worktreeinclude:
.worktreeinclude
.env
node_modules/
target/
After .worktreeinclude selects entries, you can add more gitignore-style excludes in user config, per-project user overrides, or project config:
~/.config/worktrunk/config.toml
[step.copy-ignored]
exclude = [".cache/", ".turbo/"]
To copy nothing unless .worktreeinclude exists — matching Claude Code desktop, where the file is required — pass --require-include:
wtstepcopy-ignored--require-include
Without .worktreeinclude, the command is a no-op (it reports that nothing was copied and why). With the file present, only matching files copy as above. To apply this across every repository, put the flag in a user-config hook: post-start = "wt step copy-ignored --require-include".
Files are reflinked where the filesystem supports it: APFS (macOS), btrfs and XFS (Linux), ReFS (Windows). A reflinked copy shares the source’s disk blocks until one side writes. For a 14GB target/ directory:
Command
Time
Disk
Commandcp -R (full copy)
Time2m
Disk14GB
Commandcp -Rc / wt step copy-ignored
Time20s
Disk~0
On ext4 and NTFS, which have no reflink, every file is copied in full; the summary says (reflinked, no extra disk) or (full copy).
Reflinks are per file (like cp -Rc), so copy time scales with file count.
Use the post-start hook so the copy runs in the background. Use pre-start instead if subsequent hooks or --execute command need the copied files immediately.
Git sees the symlink as a file, so .gitignore needs node_modules without a trailing slash. node_modules/ matches only directories: the link stays untracked, a commit can pick it up, and merging that commit replaces the primary worktree’s node_modules with a link to itself.
The .worktreeinclude pattern is shared with Claude Code on desktop, which copies matching files when creating worktrees. Differences:
worktrunk copies all gitignored files by default; Claude Code requires .worktreeinclude. Pass --require-include to match Claude Code (copy nothing without .worktreeinclude)
worktrunk runs as a configurable hook in the worktree lifecycle
List the available template variables with -v (alongside the expansion, on stderr). The real block prints every variable in scope; this one is abridged:
Run command in each worktree. Executes sequentially with real-time output; continues past command failures.
A summary of successes and failures is shown at the end. Context JSON — a flat object of every template variable — is provided on stdin for scripts that need structured data.
Variables substitute into each argv element before exec. See wt hook template variables for the complete list and filters.
wtstepfor-each--echo'Branch: {{ branch }}'
Each element is expanded fresh in every worktree, so {{ branch }} is that worktree’s branch. An alias wrapping for-each renders templates earlier, in the invoking worktree; nesting templates shows how to keep a variable per-worktree.
Swap a branch into the main worktree. Exchanges branches and gitignored files between two worktrees.
Experimental. Use promote for temporary testing when the main worktree has special significance (Docker Compose, IDE configs, heavy build artifacts anchored to project root), and hooks & tools aren’t yet set up to run on arbitrary worktrees. The idiomatic Worktrunk workflow does not use promote; instead each worktree has a full environment. promote is the only Worktrunk command which changes a branch in an existing worktree.
Gitignored files (build artifacts, node_modules/, .env) are swapped along with the branches so each worktree keeps the artifacts that belong to its branch. Files are discovered using the same mechanism as copy-ignored and can be filtered with .worktreeinclude.
Remove worktrees and branches merged into the default branch.
Bulk-removes worktrees and branches that are integrated into the default branch, using the same criteria as wt remove’s branch cleanup. Stale worktree entries are cleaned up too, except one whose git metadata holds staged changes or an operation in progress; git worktree repair can still restore those.
In wt list, candidates show _ (same commit) or ⊂ (content integrated). Run --dry-run to preview. See wt remove --help for the full integration criteria.
Locked worktrees, worktrees with uncommitted changes, worktrees containing another worktree, and the main worktree are always skipped. The current worktree is removed last, triggering cd to the primary worktree. Pre-remove and post-remove hooks run for each removal; a candidate whose hooks include an unapproved project command is skipped with (approval required) (pre-approve with wt config approvals add, or pass --yes).
Prune removes worktrees concurrently, so hooks that write shared resources must coordinate those writes.
Candidates younger than --min-age (default: 1 day) are skipped, so a worktree just created from the default branch isn’t removed for looking “merged” (its branch points at the same commit). A worktree’s age is its creation time; a branch with no worktree takes its age from its reflog. A branch with no reflog, which is common in bare repositories, can look new again after Git maintenance or a branch deletion, and is then skipped until --min-age passes.
wtstepprune--min-age=0s# no age guard
wtstepprune--min-age=2d# skip candidates younger than 2 days
--format=json prints one object per candidate to stdout. A live run reports branch_outcome, as wt remove does. --dry-run reports branch_deleted (whether the removal would delete the branch), reason (why the candidate qualifies), and target (what it was measured against).
When worktrees are at each other’s expected locations (e.g., alpha at
repo.beta and beta at repo.alpha), relocate automatically resolves
this by using a temporary location.
The main worktree can’t be moved with git worktree move. Instead, relocate
switches it to the default branch and creates a new linked worktree at the
expected path. Untracked and gitignored files remain at the original location.
Run a command; kill its whole process tree when its worktree is removed. Teardown is automatic and needs no pre-remove hook; the group gets SIGTERM then SIGKILL.
wt step tether - [experimental] Run a command; kill its whole process tree when its worktree is removed
Teardown is automatic and needs no pre-remove hook; the group gets SIGTERM then SIGKILL.
Usage:wt step tether[OPTIONS] -- <COMMAND>...
Arguments:
<COMMAND>...
Command to run (after --, run directly, no shell)
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.