Answer: When you exit an interactive worktree session, Claude checks the worktree for work that removal would delete and then removes it automatically if clean (for unnamed sessions) or prompts you to keep or remove it if it has work in it. For non-interactive runs with `-p`, Claude doesn't clean up their worktrees, so you must run `git worktree remove` (and `git worktree unlock` first if git refuses because the worktree is locked). Status: Confirmed Entry: tool/claude-code/features/clean-up-worktrees Revision: 4 Digest: sha256:7c5e19ef22e7df11 (changes whenever the content changes) Timeline: Created: 2026-11-13T03:06:09Z Last changed: 2026-11-20T12:26:22Z (non-interactive cleanup: — → Claude doesn't clean up their worktrees) Last verified: 2026-11-20T12:26:22Z Next check: 2026-11-21T12:26:22Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Source | As of clean worktree behavior | Claude removes the worktree and its branch automatically | [1] | 2026-11-20 worktree with work behavior | Claude prompts you to keep or remove the worktree | [1] | 2026-11-20 non-interactive cleanup | Claude doesn't clean up their worktrees | [1] | 2026-11-20 manual removal command | git worktree remove | [1] | 2026-11-20 unlock command | git worktree unlock | [1] | 2026-11-20 Sources: [1] Anthropic. "Run parallel sessions with worktrees". https://code.claude.com/docs/en/worktrees.md Role: primary. Accessed: 2026-11-20T12:26:22Z Quote: "for an unnamed session, Claude removes the worktree and its branch automatically" (Supports: clean worktree behavior) Quote: "Claude prompts you to keep or remove the worktree" (Supports: worktree with work behavior) Quote: "Non-interactive runs with `-p` have no exit prompt, so Claude doesn't clean up their worktrees" (Supports: non-interactive cleanup) Quote: "To remove one, run `git worktree remove`" (Supports: manual removal command) Quote: "if git refuses because the worktree is locked, run `git worktree unlock` on it first" (Supports: unlock command) Published: 2026-11-20T03:10:58Z Snapshot SHA-256: 5b800b1cd50f91f0fb7e85a6810c9f3d3ddfa3d9f191fe64be019213a52257f1 (captured 2026-11-19T12:21:26Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-19T12:21:28Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:26:22Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:26:22Z Last attempt: 2026-11-20T12:26:22Z Notes and limitations: Extracted automatically from a single official source (section "Clean up worktrees"). Related: https://latestn.com/tool/claude-code/features/code-mode-requirements-limits What are the requirements and limitations of Code Mode in Claude Code? https://latestn.com/tool/claude-code/features/code-review-levels What review levels does Claude Code Code Review offer? https://latestn.com/tool/claude-code/features/confirm-resolved-version How do I confirm which plugin dependency version Claude Code resolved? https://latestn.com/tool/claude-code/features/checkpointing-limitations What are the limitations of Claude Code file checkpointing, such as Bash commands or subagent edits not being tracked? https://latestn.com/tool/claude-code/features/choose-extension-by-goal Which Claude Code extension should I use for a given goal, such as adding persistent context, connecting external services, or automating workflows? https://latestn.com/tool/claude-code/features/choose-scan-effort How do I choose the scan effort level for a Claude Security scan in Claude Code? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-20T12:26:22Z | changed | non-interactive cleanup: — → Claude doesn't clean up their worktrees | [1] 2026-11-20T12:26:22Z | changed | worktree with work behavior: — → Claude prompts you to keep or remove the worktree | [1] 2026-11-20T12:26:22Z | changed | clean worktree behavior: — → Claude removes the worktree and its branch automatically | [1] 2026-11-20T12:26:22Z | changed | non-interactive runs: Claude doesn't clean up their worktrees → — | [1] 2026-11-20T12:26:22Z | changed | worktree with work in it: Claude prompts you to keep or remove the worktree → — | [1] 2026-11-20T12:26:22Z | changed | named session behavior: prompts you first so you can keep the worktree for later → — | [1] 2026-11-20T12:26:22Z | changed | clean unnamed session behavior: Claude removes the worktree and its branch automatically → — | [1] 2026-11-18T12:21:12Z | changed | unlock command: — → git worktree unlock | [1] 2026-11-18T12:21:12Z | changed | manual removal command: — → git worktree remove | [1] 2026-11-18T12:21:12Z | changed | named session behavior: — → prompts you first so you can keep the worktree for later | [1] 2026-11-18T12:21:12Z | changed | non-interactive runs: Non-interactive runs with `-p` have no exit prompt, so Claude doesn't clean up their worktrees → Claude doesn't clean up their worktrees | [1] 2026-11-18T12:21:12Z | changed | unlock command if locked: git worktree unlock → — | [1] 2026-11-18T12:21:12Z | changed | cleanup command for non-interactive worktrees: git worktree remove → — | [1] 2026-11-15T12:26:41Z | changed | clean unnamed session behavior: — → Claude removes the worktree and its branch automatically | [1] 2026-11-15T12:26:41Z | changed | unlock command if locked: — → git worktree unlock | [1] 2026-11-15T12:26:41Z | changed | cleanup command for non-interactive worktrees: — → git worktree remove | [1] 2026-11-15T12:26:41Z | changed | unlock command: git worktree unlock → — | [1] 2026-11-15T12:26:41Z | changed | manual removal command: git worktree remove → — | [1] 2026-11-15T12:26:41Z | changed | non-interactive runs: Claude doesn't clean up their worktrees → Non-interactive runs with `-p` have no exit prompt, so Claude doesn't clean up their worktrees | [1] 2026-11-15T12:26:41Z | changed | clean worktree, named session: prompts you first so you can keep the worktree for later → — | [1] 2026-11-15T12:26:41Z | changed | clean worktree, unnamed session: Claude removes the worktree and its branch automatically → — | [1] 2026-11-13T03:06:09Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/features/clean-up-worktrees/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/features/clean-up-worktrees POST: https://latestn.com/dispute/tool/claude-code/features/clean-up-worktrees with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/features/clean-up-worktrees?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I clean up worktrees that Claude Code created? Revision 4, last verified 2026-11-20T12:26:22Z. https://latestn.com/tool/claude-code/features/clean-up-worktrees (accessed 2026-11-21T09:53:55Z). @misc{LatestN_tool_claude_code_features_clean_up_worktrees_r4, title = {How do I clean up worktrees that Claude Code created?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/features/clean-up-worktrees}}, note = {Revision 4; digest sha256:7c5e19ef22e7df11; last verified 2026-11-20T12:26:22Z; accessed 2026-11-21T09:53:55Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/features/clean-up-worktrees