Urgent.News

What's breaking now, across thousands of outlets.

Tech

The git worktrees your coding agents leave behind, and how to clean them up

Claude Code, Cursor and Codex run in git worktrees so several agents can work at once. Each worktree is a full checkout with its own node_modules and build output, and they pile up quietly. One Claude Code user found 27 forgotten worktrees using 80 GB ( issue 63087 ). 61 Codex worktrees of a Rails app took about 100 GB ( issue 35383 ). Where they live Claude Code: .claude/worktrees/ inside each…

Multiple coding agents, such as Claude Code, Cursor, and Codex, operate within git worktrees, allowing simultaneous work. However, these worktrees can accumulate, consuming considerable disk space. A Claude Code user discovered 27 worktrees consuming 80 GB, while 61 Codex worktrees for a Rails app occupied about 100 GB (issue 63087, 35383).

These worktrees reside in specific directories: .claude/worktrees/ within each repository (earlier versions utilized ~/.claude-worktrees), ~/.cursor/worktrees/ for Cursor, and ~/.codex/worktrees/ for Codex, operating on detached HEADs rather than branches.

To inspect the space they occupy, use git worktree list in a repository and du -sh .claude/worktrees/* 2 /dev/null | sort -h. For Cursor and Codex, apply du -sh ~/.cursor/worktrees/*/* ~/.codex/worktrees/* 2 /dev/null | sort -h.

Before removing a worktree, verify its status with git -C path status --short. If no uncommitted changes exist, use git -C path status --short --ignored to check for ignored files like .env. For squash merges, confirm their absence by checking if the branch has been merged into main using gh pr list --head branch --state merged --json headRefOid and comparing it with git rev-parse branch.

To prevent the buildup of worktrees, adjust the settings: Claude Code allows lowering cleanupPeriodDays (default 30), Cursor enables lowering cursor.worktreeMaxCount (default 25), and Codex can reduce the limit of 15 kept worktrees in its settings. For a practical solution, Mopup, a Mac application, automates these checks and only removes finished worktrees, never using --force, ensuring no committed data is lost. Mopup is free to scan repositories.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Auditing SPF and DMARC for a whole list of domains: p=none, ~all and the other ways a "pass" misleads you

Checking one domain's email authentication takes a minute in a terminal. Checking 300 customer, supplier or portfolio domains is where people script it, and where most scripts quietly report the wrong…

  • Read TXT records for SPF and DMARC, handle split chunks
  • Two SPF records equal none; flag >1 as broken
  • SPF policies: -all (fail), ~all (softfail), ?all (neutral), +all (pass-everyone)

4.26 Hours of Rootless Debian 13 on Samsung DeX: Thermal, Battery & Compiler Telemetry

When Samsung discontinued the official Linux on DeX project years ago, running a real Linux desktop on Android mostly became an exercise in compromises: sluggish VNC sessions, software-rendered UIs…

  • 4.26-hour soak test maintained SoC temperature at 36.0 °C median
  • Battery temperature dropped from 30.3 °C to 26.7 °C during test
  • Battery level remained at 80% with no degradation

More from Saturday 14 November →