When the last linked worktree is removed (either via /exit from a worktree or when an agent worktree is cleaned up), Claude Code now checks whether extensions.worktreeConfig was enabled by Claude and restores the git config to its pre-worktree state automatically.
Evidence
Worktree config cleanup (search for "Restored extensions.worktreeConfig in" and "enabledWorktreeConfigExtension")
Strings lifted out of the shipped bundle, so the claim above can be checked against them.
One source agreesOne thing we can check says the same as this entry.
Anthropic's release notes agree
Fixed extensions.worktreeConfig being left in the repo's .git/config (breaking go-git tools like tea) after the last worktree.sparsePaths…