Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
0.80.0 commit research (fixture)
The per-group research notes the 0.80.0 release drafted its Fixed section from, verbatim apart from scratch paths. See README.md, "Fix prominence".
Fix commits
Most of these PRs fix narrow edge cases, but three matter to ordinary users, and one of them changes existing behaviour:
- #4206 fixes a failed squash that rewound the branch. Any failing git commit hook or signing failure during
wt mergeorwt step squashused to leave the branch at the merge base. - #4206 also changes what git commit hooks see. They now run on a detached HEAD, so a hook that reads the branch name gets
HEAD. - #4252 fixes silent data loss in
wt remove. It deleted uncommitted submodule work whenever a submodule ignore setting was on.
"Repro" below means I ran the v0.79.0 binary against the current debug build (v0.79.0-62-g4b8e6f986) in mktemp -d scratch repos, with isolated config and git 2.55 on macOS. "Code" means I read the diff and the old file.
A. Squash and commit correctness
#4206 — squash commits on a detached HEAD · d65b1a07f · PR
- Old: the squash ran
git reset --soft <merge-base>, thengit commit. If the commit failed, the branch was left at the merge base with all its commits collapsed into staged changes. The command reported✗ Failed to create squash commit. The work could be recovered from ORIG_HEAD or the reflog. - New: the branch keeps its commits until the squash commit exists, so a failure changes nothing.
- Conditions:
wt mergewith squash (the default) orwt step squash, and 2+ commits (or 1 commit plus staged changes), andgit commitfailing. The commit fails when a gitpre-commit/commit-msghook rejects it (the pre-commit framework, husky, lefthook) or signing fails. - Repro: a
.git/hooks/pre-committhat exits 1.- v0.79.0:
main..featureis empty anda/bare staged. - New: both commits remain on the branch.
- v0.79.0:
- Who hits it: many people. Hook frameworks are common and formatter hooks routinely fail.
- Behaviour change, not in the subject:
- Git's
pre-commit,commit-msgandpost-commithooks now see a detached HEAD. In the reprogit rev-parse --abbrev-ref HEADprintedfeatureon v0.79.0 andHEADnow. - Hooks that derive a ticket prefix from the branch name will silently stop working for squash commits.
- The
wt step squashhelp text now says the commit is made on a detached HEAD.
- Git's
- Bundled fix (commit signing): the check for whether to sign now asks git directly.
- Old: a key written as bare
gpgsign(no= true) or set in worktree-scoped config was read as false, sowt merge --no-ffproduced an unsigned merge commit. - Repro: with a fake gpg program, v0.79.0 merged unsigned with 0 gpg calls. The new build called gpg, which fails as intended with the fake program.
- Who hits it: rare.
- Old: a key written as bare
- Bundled fix (empty-squash check): a squash whose only change is a submodule pointer hidden by
submodule.<name>.ignoreis now committed. Before, it reported "No changes after squashing" (code).
#4192 — staged-change check uses plumbing · efa59ee8c · PR
- Old: the check was
git diff --cached --quietinwt step commit,wt merge's commit step and squash, and any git error counted as "has changes". - Condition that reaches users:
submodule.<name>.ignore=alland the only staged change is a submodule pointer.- Repro: v0.79.0 gave
✗ Nothing to commit. New gives✓ Committed changes. - In squash (code): with 1 commit, that staged pointer was treated as "already a single commit" and left out.
- Repro: v0.79.0 gave
- Not reachable from the CLI: the PR's
diff.relativecase, where the check runs from a subdirectory.wt step commitrun from a subdirectory withdiff.relative=trueworked on v0.79.0 because wt runs git at the worktree root ([repo]in the-vvtrace). - Who hits it: very few.
#4251 — merge decides whether to commit using the --stage mode · d65adb038 · PR
- Old:
wt merge --no-squashwith existing commits aborted with✗ Nothing to commitwhenever the worktree was dirty but the stage mode would stage nothing. Main was not updated. - Conditions:
--no-squash(or squash disabled in config), and either of:--stage=trackedornonewith only untracked files. Repro'd for both.- Dirty submodule contents under the default
--stage=all. Repro'd.
- New: it merges. Without
--no-remove, removing the worktree afterwards still refuses because of the untracked file (repro). - Who hits it: few.
B. Data loss: submodule ignore settings hid changes from wt remove
#4252 · c2feef082 · PR
Old: the dirty check honoured the user's submodule ignore setting. wt then ran
git worktree remove --force(always required when submodules are present), which deleted the worktree including uncommitted submodule changes.Conditions: the worktree has an initialized submodule, and any of these settings is on:
submodule.<name>.ignore=allordirty, including when committed in.gitmodulesdiff.ignoreSubmodulesin git config
and the submodule has modified files (or, under
ignore=all, unpushed commits).Repro: I reproduced all of
ignore=all,ignore=dirtyvia.gitmodules,diff.ignoreSubmodules=dirty, and an unpushed submodule commit underignore=all. v0.79.0 printed✓ Removed feature worktree & branchand the file was gone. New refuses with✗ Cannot remove worktree: feature has uncommitted changes / M sm.Other paths (code): the same check guards removal in
wt merge,wt step pruneandwt step promote.Who hits it: a minority (submodule users with an ignore setting), but it is silent data loss.
C. Stale and orphan worktree removal
#4226 and #4228 · 7193c0944, 3de0b5f29 · #4226, #4228
#4228 supersedes #4226 for users, so the net change from v0.79.0 is what matters. The trigger is a worktree whose .git file was deleted while its directory remains. macOS's $TMPDIR cleanup does this; so does a copy that skipped dotfiles.
- Detached stale entry:
- v0.79.0:
wt step prunefailed with✗ pruning stale worktree for (detached …) fatal: validation failedand every later prune in that repo failed the same way. Repro. - New: the entry is unregistered.
- v0.79.0:
- Branch stale entry:
- v0.79.0:
wt remove featureprinted✗ Worktree directory missing for feature / ↳ To clean up, run git worktree prune, and prune silently skipped it. Repro. - New:
✓ Pruned stale worktree & removed branch feature (same commit as main, _). The directory and its files stay. Repro.
- v0.79.0:
- New safeguard: a stale entry whose index holds staged changes, or with a rebase/merge/bisect in progress, is kept.
- v0.79.0 pruned it along with its index. Repro: staged file, then
rm -rfof the directory. - Now prune skips it silently, and
wt removesays✗ Worktree for staged is stale but holds staged changes, with hints for-forgit worktree repair. Repro.
- v0.79.0 pruned it along with its index. Repro: staged file, then
- Bundled text and behaviour changes:
- Error: "Worktree directory missing for X" is now "Worktree for X is stale; its directory or .git is gone". The hint is now
git worktree repair <path>instead ofgit worktree prune. - The
⊟legend now reads "Prunable (worktree directory or its.gitgone)". - The prune help and the FAQ have new text.
- The picker's branch-only removal now also unregisters the stale entry.
- Error: "Worktree directory missing for X" is now "Worktree for X is stale; its directory or .git is gone". The hint is now
- Who hits it: macOS temp-dir worktrees, occasionally.
#4233 — orphan worktree (git worktree add --orphan) before its first commit · 2a4aa28c2 · PR
- Old (all repro'd):
wt remove freshremoved the worktree but printed a bogus↳ Branch unmerged; to delete, run wt remove -D fresh.--foregroundended with✗ git rev-parse --verify … failed / fatal: Needed a single revision.- On a stale orphan it printed
○ Branch fresh3 retained; has unmerged changesplus the-Dhint.
- New: clean
✓ Removed fresh2 worktree/✓ Pruned stale worktree for fresh3. - Who hits it: very few.
D. --separate-git-dir repositories
#4236 · a56e6d991 · PR
- Old:
{{ repo_path }}resolved to the parent of the git store, so new worktrees landed outside the project.wt listdidn't mark main as current.wt removefailed withfatal: not a git repository. - Conditions: the repo was created with
git init/clone --separate-git-dir, andgit worktree repairhas been run. Repair writes the<store>/gitdirbacklink the fix reads. - Repro:
- With repair: v0.79.0 created
…/tmp.X.probeandwt removefailed. New created…/work.probe,wt listshows@ main, and remove works. - Without repair: both versions are broken identically, as the PR states.
- With repair: v0.79.0 created
- Who hits it: almost no one.
E. Branch and remote names starting with -
- #4253 (96a00efbe, PR): the background removal fallback, used when renaming the worktree directory fails (e.g. across filesystems), ran
git branch -D <branch>. A-xbranch was parsed as an option, so the worktree went and the branch stayed. It now uses-- <branch>(code). - #4267 (2014eb3f1, PR): a remote named
-xbroke remote-HEAD lookup, the default-branchls-remotefallback and remote-URL lookup. Separators were added (code). - #4277 (51f9a7cb1, PR): in a bare repo whose default branch starts with
-and has no worktree checked out,git show -x:.config/wt.tomlfailed quietly and all project config (hooks, aliases) vanished without an error (code).
Git's normal commands refuse branch names starting with - (only plumbing like update-ref creates them), and dash-leading remote names need git remote rename -- origin -x. Near-zero users; I didn't reproduce these.
F. Non-UTF-8 filenames (Linux only; macOS's filesystem rejects them, so not repro'd)
- #4257 (2710f7a82, PR):
wt step copy-ignoredandwt step promotedecoded ignored paths lossily, so the lookup missed the real file.- An ignored file with such a name was silently skipped:
copy_leaftreats a missing source as vanished and logs only at debug level. - A top-level directory with such a name errored with "reading directory".
promoteleft the entry unstaged, so it wasn't swapped.- JSON output now shows the name lossily.
- An ignored file with such a name was silently skipped:
- #4259 (98533f377, PR):
wt step push's conflict check could collapse two different names (e.g.collision-\xFEandcollision-\xFF) into the same string. That produced a false conflict that refused the push. It also merged two duplicate status parsers into one.
Near-zero users for both.
G. Claude Code config dir and wt config show
- #4262 (48d92561e, PR): Windows only, when
HOMEdiffers fromUSERPROFILE. The PR's evidence sets a POSIX-styleHOME.- Old:
install-statuslinereported✓ Statusline configuredbut wrote underHOME, where Claude Code (which usesUSERPROFILE) never looks.wt config showreported a correctly installed statusline as "not configured". - Unix behaviour is unchanged (code).
- My inference, not verified: Git Bash may pass
HOMEto native programs already converted toC:\Users\…. If so, the realistic population is Windows users withHOMEpointed elsewhere, such as a corporateH:\drive. That's small.
- Old:
- #4247 (f88b827c4, PR):
CLAUDE_CONFIG_DIRset to an unexpanded literal~madeinstall-statuslinecreate a directory named~in the current directory. The change also expands~\fooon Windows (code). Needs the variable set somewhere that doesn't expand~, so near zero. - #4255 (bbab727d7, PR):
wt config show --fulloutside a git repo printed only✗ git rev-parse --git-common-dir failed (exit 128)and lost the whole report. Repro. It now renders USER CONFIG and DIAGNOSTICS. Anyone running it outside a repo hits this, so it's plausible but low-stakes.
Perf, docs, and remaining fix commits
Four of the fixes are user-facing and reproduced cleanly against v0.79.0. The five perf PRs add up to two speedups. #4261 is filed as "docs:" but changes what wt does. I built each fix repro in a mktemp -d scratch repo and ran it with the installed v0.79.0 binary and with a copy of target/debug/wt built at HEAD 4b8e6f986. Nothing in the worktree was touched.
Fixes
#4281 wt step diff counts only the branch's own changes when local main is stale — dacc21a39, https://github.com/max-sixty/worktrunk/pull/4281
- Old: the diff base was
merge-base(HEAD, target). If the branch was built onorigin/mainand localmainlagged it, every upstream commit the branch sits on showed up as the branch's own change. - New: the base comes from
span_upstream, the same rulewt merge,wt step squashandwt step rebasealready use. Sowt step diffnow matches whatwt mergewould squash. - To hit the old bug: run
wt step diffwith the default or a local-branch target, and that target has an upstream configured, and localmainis behindorigin/main, and the branch forked from the newerorigin/main. An explicitorigin/mainor a SHA target is unchanged. - Reproduced: 3 upstream commits pushed from a second clone and fetched, local
mainleft stale, one feature commit.wt step diff -- --name-onlyprintedfeature.txt up1.txt up2.txt up3.txton 0.79.0 andfeature.txton current.
#4279 hook-log JSON reports real branch names; two Tips recipes fixed — 17b100ef3, https://github.com/max-sixty/worktrunk/pull/4279
- Output change, worth flagging: in
wt config state logs --format=json, thehook_output[].branchfield used to hold the sanitized log directory name. It is now the real branch name, ornullwhen no local branch writes to that directory (branch deleted, detached HEAD, or two branches sharing a directory).- Reproduced: for
feature/x, 0.79.0 printed"branch":"feature-x-x2d"and current prints"branch":"feature/x". - Anyone filtering on the sanitized form (for example the old extending-page
hook-logalias withsanitize_hash) needs to update.
- Reproduced: for
- Bundled doc fixes:
- The "Database per worktree" recipe passed three
KEY=VALUEpairs to onevars setcall, and used the keydb_url. Now three chainedvars setcalls and the keydb-url. - "Monitor hook logs" used
wt config state logs get --hook=…. Now ajqrecipe, and thewtlogalias became a shell function. - The
wt config state logs --helpexamples now match the branch exactly instead of usingstartswith/head -1, and the help gains a sentence explainingbranchandnull. - The
hook-logalias on the extending page was updated to match.
- The "Database per worktree" recipe passed three
- Reproduced: the old recipe commands fail on 0.79.0 and on current alike, so this half is a docs fix:
vars set a=1 b=2givesunexpected argument 'b=2'.vars set db_url=xgivesInvalid key "db_url".logs get --hook=…givesunexpected argument '--hook'.
#4276 removal hooks survive the user config file changing mid-command — e1cc1295e, https://github.com/max-sixty/worktrunk/pull/4276
- Old: the pre-remove and post-remove steps each re-read the user config at hook time. If that read failed, the hooks were skipped silently. That covers pre-remove itself, and post-remove plus post-switch together.
- New: both steps use the config snapshot taken at command start.
- To hit the old bug: the user config file becomes unparseable after the command starts (an invalid config at startup already fails
wt removeandwt mergeup front) and removal hooks are configured.- In practice this means a pre-remove hook, or a concurrent process, corrupts the config file, and post-remove/post-switch then vanish.
- The code is the shared removal path in
src/output/handlers.rs, so it applies towt remove, merge cleanup, prune and picker removal. I tested onlywt remove.
- Reproduced: a pre-remove hook writes
invalid = [over the config, followed bywt remove --foreground --force-delete feature. On 0.79.0 there was no "Running post-remove" line and no marker file. On current the line appears and the marker file is written. - The PR body says the snapshot is "passed through direct remove, merge cleanup, step prune, and picker removal paths". The merged diff only touches
handlers.rs(19 lines) plus a test.
#4274 leaving the picker no longer strands .merge_file_* files — 05d1315d0, https://github.com/max-sixty/worktrunk/pull/4274 (closes https://github.com/max-sixty/worktrunk/issues/4273)
- Old: on picker exit,
wtsent SIGTERM to background git processes, includinggit merge-treeprobes. If a probe was inside an external merge driver, git never cleaned up the driver's three temp files. - New: a probe that has already started runs to completion. One that hasn't started still never spawns.
- To hit the old bug: a gitattributes
merge=<driver>is set (for example mergiraf) and some branch conflicts with the target so the probe calls the driver and you leavewt switch(Esc or accept) while the driver is still running. The files landed in the main worktree root as untracked files. - Reproduced with tmux, using the issue's
sleep 3; exit 1driver and Esc after 1.5s: 0.79.0 left 3.merge_file_*files on each of 2 runs; current left 0 on each of 2 runs. - Trade-off (PR body): an abandoned probe now outlives
wtfor as long as the driver runs.
Perf: two user-visible speedups
A. wt list and the wt switch picker settle faster in repos with many worktrees (#4286, #4290, #4288, #4284)
- #4286 — d13e362cd, https://github.com/max-sixty/worktrunk/pull/4286
- Tasks now run in display order (
par_bridge), so picker rows fill in from the top down. Detached (mid-rebase) worktrees are also looked up concurrently before the skeleton, instead of one after another. - PR body, ~140-worktree repo, 5 runs: time from rows appearing to visible rows dimmed went from 275–1584ms to 150–230ms.
wt listskeleton median went from 178ms to 103ms. - Costs, per the PR: the
wt listtotal rose 417 to 461ms. With--fulland 249ghcalls, the last CI result arrived at 6168ms against 5549ms on main, so CI results arrive later.
- Tasks now run in display order (
- #4290 — 4b8e6f986, https://github.com/max-sixty/worktrunk/pull/4290
- Builds the ref snapshot from branch inventories already cached for the command.
for-each-refscans per run drop from 3 to 2 forwt listand from ~4.4 to 2 for the picker. - PR body, 50 worktrees, 52 local and 103 remote branches, "task pool opens" median:
wt list93 to 78ms; picker 120 to 47ms.
- Builds the ref snapshot from branch inventories already cached for the command.
- #4288 — b3530bfb3, https://github.com/max-sixty/worktrunk/pull/4288
- Picker only: two setup steps move off the path that delays the task pool.
- The PR estimates ~10ms saved idle and up to ~130ms under load. It has no end-to-end measurement (load average was 55–164).
- #4284 — a6930b76c, https://github.com/max-sixty/worktrunk/pull/4284
- macOS only (
#[cfg(unix)], builtin fsmonitor enabled).wtnow checks the daemon's socket before forkinggit fsmonitor--daemon startfor each worktree. - PR body: saves 100–300ms before the task pool opens in a 128-worktree repo.
- macOS only (
B. Far fewer forge API calls for CI status (wt list --full, statusline, picker)
- #4289 — 7294e7964, https://github.com/max-sixty/worktrunk/pull/4289
- The PR/MR lookup is skipped for local branches that were never pushed: no remote has the name, and the push remote's fetch refspec would have recorded it. Applies to every forge.
- PR body, 239 local branches of which 19 exist on origin, load average ~30:
ghcalls 249 to 25; last CI result median 9.25s to 5.2s; wall median 12.0s to 9.6s. - Bundled help/docs change: the blank-CI row in
wt list --helpand list.md now reads "Branch never pushed" instead of "No upstream". - Behavior trade-off: a PR opened from a branch that another clone pushed shows nothing until this clone fetches.
--single-branch/--depthclones and URL push remotes (for example aftergh pr checkoutof a fork's PR) are still queried.
- #4216 — 325153bb3, https://github.com/max-sixty/worktrunk/pull/4216
- GitLab only: the project ID is resolved once per command instead of one
glab repo viewper row. - The PR's test goes from 5 calls to 1. There is no timing number.
- GitLab only: the project ID is resolved once per command instead of one
Docs and user-facing text
- #4261 (f732cbda7, https://github.com/max-sixty/worktrunk/pull/4261) is a behavior change despite the
docs:prefix. Changelog-worthy.- The recommended Codex command changed:
gpt-5.6-luna/lowbecomesgpt-6-lunawith reasoningnone. It adds--ephemeraland a set of-cflags that disable features, and dropssystem_prompt='', which Codex 0.156.1 rejects under--strict-config. - The command points
model_instructions_fileat~/.codex/worktrunk-commit-instructions.txt. - Accepting the first-run "Configure codex for commit messages?" prompt now creates that one-character file. It prints new info, success and hint lines, including "Keep … the saved Codex command requires it".
- The FAQ lists the file among those Worktrunk creates.
- PR body: the saved command used 13,729 input tokens on a sample query. In the separate comparisons (one-character file, then each disable), input fell 27,890 to 24,371 and 24,572 to 13,721.
- The recommended Codex command changed:
- #4268 (8e4f8535f, https://github.com/max-sixty/worktrunk/pull/4268) corrects the
wt stephelp:--stage=nonesquashes commits plus what is already staged.wt step prunealso skips worktrees with uncommitted changes.- The PR verified both by hand; I only read the diff.
- #4212 and #4213 (6521a8218, 56a4bccd0) extend the lede on the README and docs home with "…hooks to automate local workflows & copy-on-write build caches."
- #4214 (abd7acaa6) narrows the docs-site content column to fit the 99-column terminal examples and regenerates the
wt list --helpexamples at 99 columns. Cosmetic. - #4219 (1d46bfca7) removes
--no-hooksfrom the shipped worktrunk skill's sub-Agent example, with guidance on when to add it back. It affects plugin and skill users; minor.
Internal only
- Candidate Internal bullet: #4245 (650263036) and #4246 (e8b264c01) move project agent guidance into
AGENTS.md, shared by Codex and Claude Code, and trim it from 2,769 to 380 lines (PR body). - Also internal:
- #4287 (ebb27e3bf) deletes the nine one-line
CLAUDE.mdforwarders. - #4283 (69d02a03a) adds a doc-cruft rule to
AGENTS.mdand tend review. - #4207 (5d994f93c) and #4269 (1f71c08dd) are test-only.
- #4232, #4244 and #4254 (22bd6beba, ce1862450, f4563a279) are comment-only; I confirmed no code lines changed.
- #4287 (ebb27e3bf) deletes the nine one-line
The Fixed section as first drafted
A failed squash no longer rewinds the branch: when
git commitfailed duringwt mergeorwt step squash— a pre-commit hook rejecting it, or signing failing — the branch was left at the merge base with its commits collapsed into staged changes. The squash now commits on a detached HEAD and moves the branch only once the commit exists. (Breaking: git commit hooks seeHEAD, not the branch name, during a squash.) (#4206, thanks @Bennyjitsu for finding it in #4193)wt removeno longer deletes submodule changes hidden by config: withsubmodule.<name>.ignore(allordirty, including from.gitmodules) ordiff.ignoreSubmodulesset, and uncommitted changes inside a submodule, the worktree read as clean and was removed with them.wt merge,wt step prune, andwt step promoteshared the check. (#4252, thanks @Duang777)wt step diffshows only the branch's changes when localmainis stale: with a target that tracks an upstream and a branch forked from a newerorigin/mainthan localmain, the diff included every upstream commit in between. It now uses the same base aswt merge. (#4281, thanks @starlightromero for reporting #3519)Leaving the picker no longer strands
.merge_file_*files: with an external merge driver set in gitattributes and a conflicting branch, exitingwt switchwhile a conflict probe ran left the driver's temp files in the main worktree. A started probe now runs to completion. Fixes #4273. (#4274, thanks @brndnmtthws for reporting)wt merge --no-squashmerges when the stage mode stages nothing: with--stage=trackedornoneand only untracked files, or dirty submodule contents, it aborted with "Nothing to commit". (#4251, thanks @Duang777)Commit and squash see a staged submodule pointer hidden by
submodule.<name>.ignore=all:wt step commitreported "Nothing to commit", and squash left the pointer out or reported "No changes after squashing". (#4192, #4206, thanks @Duang777)Hook-log JSON reports real branch names:
wt config state logs --format=jsonput the sanitized log directory name (feature-x-x2d) inbranch; it now holdsfeature/x, ornullwhen no local branch owns the directory. (Breaking: filters on the sanitized form need updating.) (#4279)Removal hooks run after a pre-remove hook rewrites the user config: if the config file stopped parsing mid-command,
post-removeandpost-switchhooks were skipped silently. They now use the config read at startup. (#4276, thanks @Duang777)wt merge --no-ffsigns merge commits whenever git would: a baregpgsignkey, or one set in worktree-scoped config, read as off, so the merge commit went unsigned. (#4206)wt config show --fullworks outside a git repository: it printed only agit rev-parsefailure; it now shows the user config and diagnostics. (#4255)Repositories created with
--separate-git-dirresolve their path: aftergit worktree repair,{{ repo_path }}pointed at the git store's parent, so new worktrees landed outside the project andwt removefailed. Fixes #4235. (#4236, thanks @zengzheqing for reporting)Statusline install finds Claude Code's config directory: on Windows with
HOMEdiffering fromUSERPROFILE, it wrote where Claude Code never reads; a literal~inCLAUDE_CONFIG_DIRcreated a directory named~. (#4262, #4247, thanks @hiro-nikaitou)Branch and remote names starting with
-: a background removal left such a branch undeleted, a remote named that way broke default-branch detection, and a bare repo with such a default branch loaded no project config. (#4253, #4267, #4277, thanks @Duang777)Non-UTF-8 file names:
wt step copy-ignoredandwt step promoteskipped ignored files with such names, andwt step pushcould report a false conflict between two of them. (#4257, #4259, thanks @Duang777)