Give one worktree its own git config

internals & scripting

// what it does

Repository config is shared across worktrees by default. Enabling the worktreeConfig extension gives each worktree a private config.worktree file, edited with git config --worktree — useful for per-worktree sparse-checkout state, a different core.hooksPath, or worktree-specific tool settings.

// shell

$ git config extensions.worktreeConfig true
$ git config --worktree core.hooksPath .hooks-agent

// gotcha

Enabling the extension changes repository semantics: if core.bare or core.worktree exist in the shared config you must move them into the main worktree's config.worktree, and Git versions that predate the extension will refuse to touch the repository.

// resources