Tech
Claude Code deletes clean worktrees on exit without asking. git worktree lock stops it.
TL;DR
If you /exit a claude --worktree <name> session with no uncommitted changes and no new commits , Claude Code removes the worktree and its branch without showing the Keep/Remove dialog.
This is documented behavior, not a bug. There is no setting to turn it off.
Claude Code holds its own git worktree lock on the worktree and only ever releases locks whose reason matches its own format. Re-lock the worktree with your own reason and the cleanup backs off.
A Sessi...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to