Cleanup

Cleanup removes worktrees nobody has touched for a while. It is off until you turn it on.

[cleanup]
enabled = false
idle_days = 14
delete_branch = true
ask_before_sweep = false
		
  1. the local branch; the remote is left alone

A worktree is idle when nothing happened in it for idle_days: no agent output, keystrokes, hook events, commits or pull request updates. The same safety rules as removing apply: dirty, unpushed and pinned work is never removed.

The cleanup rules in Repos

With cleanup on, Repos shows what the next sweep would do. Sweeps run hourly unless ask_before_sweep is set; gC runs one now, after a confirmation that lists every worktree it would remove.

The sweep banner: what would be removed, what is kept