{"version":"2.1.304","anchor":"linked-worktree-git-checks-reject-more-cases-and-file-reads","canonical_anchor":"linked-worktree-git-checks-reject-more-cases-and-file-reads","heading":"Git worktree checks now guard against files swapped while being read","tier":"internal","area":"Worktrees","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.304\/e\/linked-worktree-git-checks-reject-more-cases-and-file-reads","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.304","markdown":"### Git worktree checks now guard against files swapped while being read\n\nWhen reading git files for a linked worktree, Claude Code now checks the opened file is the one it inspected and reads nothing if not\n\n**What**\n\nA linked worktree is an extra working copy of a git repository that shares the same history. Claude Code checks the git files behind a linked worktree before trusting it.\n\nTwo things changed:\n\n- When reading the end of one of these git files, Claude Code now confirms that the file it opened is the same file it looked at a moment earlier. If they differ, it reads nothing and logs a note saying so.\n\n- An extra check on the git directory paths now rejects more worktree setups.\n\n**Why**\n\nThis protects against a file or a shortcut link in the git directory being swapped for another one between the moment Claude Code checks it and the moment it reads it.\n\n- Area: Worktrees\n- Tier: Under the hood\n- Useful: 1\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: no"}