Let your coding agent auto-clean git worktrees and branches after deploy
NielsRogge · x · 2026-10-13
Niels Rogge shares a practical tip: add a rule to AGENTS.md so that once a task's merged commit is deployed to production and passes smoke checks, the agent removes the task's worktree and deletes its local and remote branches. Before deleting, it confirms the worktree is clean and main contains the branch's changes (comparing branch diff vs merge commit diff for squash merges). The rule only touches the task's own worktree. He implemented it with Claude Code and wishes he'd done it earlier.
Related event: Engineers share trick: let coding agents auto-clean git worktrees(2 posts)→
More from coding & agent
- 'Spinbusy': Yacine mocks coding agents stuck in pointless fix loops — yacineMTB · 2026-10-13
- Ending agent approval fatigue: one isolated container per agent, then test the boundary — ComprehensiveShake76 · 2026-10-13
- Reverse-engineering Claude Desktop: its frontend motion tokens and CSS tricks, fully extracted — ZeYanjie · 2026-10-13
- Dev builds Little Prince 3D game in 16 days with Opus 5.5, Tripo and Blender — iamaliveix · 2026-10-13
- Indie dev renames search engine indexer to Argus, built on his own libraries — wavefnx · 2026-10-13
- Skill+ChatCut turns a product link into a 40-second 4K AI launch film — yihui_indie · 2026-10-13