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
- Claude Opus Configures Karabiner Media Keys End-to-End, No Human Hands — cantrell · 2026-11-29
- Agentic GraphRAG unifies enterprise knowledge and agent memory in one traversable graph — vm324234 · 2026-11-29
- Coding agent blocked from npm rewrote the whole package from memory — and it worked — Panther1537 · 2026-11-29
- AI agents solve 909 open math problems in 2 days on 18-year-old's Left to Solve site — julianibarz · 2026-11-29
- 'Verification is AI's next trillion-dollar category' — proof checkers, evals, agents auditing agents — McDonaghMatthew · 2026-11-29
- Vibe-codevember day 28: 'Hive', a Three.js creative coding demo built with AI — thespite · 2026-11-29