{"version":"2.1.326","anchor":"bash-tool-blocks-git-commands-that-alter-the-users-checkout","canonical_anchor":"bash-tool-blocks-git-commands-that-alter-the-users-checkout","heading":"Claude is stopped from running git commands that could move your branches","tier":"notice","area":"Worktrees","scope":"individual","heads_up":true,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.326\/e\/bash-tool-blocks-git-commands-that-alter-the-users-checkout","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.326","markdown":"### Claude is stopped from running git commands that could move your branches\n\nClaude Code can now flag git commands like update-ref, reflog or filter-branch that, run from a worktree, could change your own branches\n\n**Unclear.** It is not known whether the check is switched on by default, so it may not be active for you.\n\n**What**\n\nA worktree is a separate working copy of a git repository that shares the same branches as your main copy. Claude can work in one so its changes stay apart from yours. Some git commands run in a worktree can still move or rewrite your own branches.\n\nClaude Code now has a check that flags these git commands when Claude runs them through its shell tool:\n\n- `update-ref`\n\n- `symbolic-ref`\n\n- `replace`\n\n- `reflog`\n\n- `filter-branch`\n\n- `worktree`\n\n- `refs`\n\n- `history`\n\nWhen one is flagged, Claude Code gives advice on what to do instead and tells Claude to leave your branches as they are, even to undo a mistake. The check is controlled by a setting that is switched on from Anthropic's servers.\n\n**Why**\n\nThis protects your branches from changes made by Claude while it works in a worktree.\n\n- Area: Worktrees\n- Tier: You'll notice\n- Useful: 3\/5\n- Signal: 2\/5\n- Scope: individual\n- Heads-up: yes"}