[READ-ONLY] Mirror of https://github.com/mostlyobvious/dotfiles.

Store all worktrees under a shared ~/Code/worktrees root master

* Claude Code's default drops worktrees inside each repo under .claude/worktrees, cluttering the repo and scattering them across the filesystem. A global WorktreeCreate hook redirects every repo's worktrees to ~/Code/worktrees/<repo>/<branch> instead. * The hook fully replaces git's default worktree creation, which also disables Claude Code's native .worktreeinclude copy step. So the script copies the gitignored local config a fresh checkout lacks — devenv.*, .envrc, .env, .mcp.json, and .claude local settings/hooks — from the repo's main checkout into each worktree. * New branches start fresh off origin's default branch (falling back to HEAD when there's no origin), matching Claude Code's own default. The path is namespaced by repo so slugs can't collide across repos. * Wrapped via writeShellApplication so shellcheck gates the script at build time — a non-zero exit or stray stdout would otherwise abort worktree creation. Docs: https://code.claude.com/docs/en/hooks.md#worktreecreate


+71
3 changed files