{"version":"2.1.310","anchor":"worktree-git-guard-handles-git-init-find-exec-and-expor","canonical_anchor":"worktree-git-guard-handles-git-init-find-exec-and-expor","heading":"Worktree guard catches more ways git commands could reach the shared repository","tier":"notice","area":"Git","scope":"individual","heads_up":true,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.310\/e\/worktree-git-guard-handles-git-init-find-exec-and-expor","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.310","markdown":"### Worktree guard catches more ways git commands could reach the shared repository\n\nThe guard keeping git commands inside a worktree now catches risky `git init` options, `find -exec` with git, and bare git variable assignments\n\n**Unclear.** Whether the new checks are switched on depends on two server switches whose defaults are not known.\n\n**What**\n\nA worktree is a separate working copy of a git repository that shares that repository's history. Claude Code has a guard that keeps git commands inside the worktree. It used to refuse only a command whose words up to git's subcommand were filled in when the command ran. It now also catches:\n\n- `git init` with words filled in when the command runs.\n\n- `git init` with `--template`, `--separate-git-dir` or `--shared`, options that act on the shared repository rather than the worktree.\n\n- `{}` in the words after git when it runs under `find -exec`, which fills in file names.\n\n- A variable that changes which repository git uses, set on a line by itself, which now gets a hint to set it on the command or with `export`.\n\nThese new checks sit behind two switches controlled from the server.\n\n**Why**\n\nThey close gaps that could let a command, including one run by Claude, escape the worktree and change the shared repository.\n\n- Area: Git\n- Tier: You'll notice\n- Useful: 1\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: yes"}