Why GenAI Hates Deleting Code and How git rm -f Saves the Day
AI coding tools are hoarders: they never want to delete code. Here's a simple fix.

Ever noticed how GenAI coding tools like GitHub Copilot or ChatGPT behave like digital hoarders? They'll generate code, add features, but ask them to delete something — it's like asking a cat to take a bath. "But it might be useful someday!" the AI seems to think, leaving dead code to rot in your repo.
The Problem: AI's Packrat Syndrome
Turns out, this isn't a bug but a feature of training. Models were trained on code where deletions are rare (who commits git rm -f in training data?). So AI would rather add a crutch than suggest a refactor that removes code. Sounds familiar? Like that colleague who's terrified of touching legacy code.
The Fix: DIY with git rm -f
The author offers a simple recipe: don't wait for AI to grow a spine — clean up yourself with git rm -f. Yes, it's not AI magic, but it works. To prevent AI from messing up again, use precise prompts like "delete function X and all its callers". And always review, or your CI will fail.
METABYTE studio's take: Deleting code is a skill too, especially when AI spawns entities faster than you can review them. At METABYTE we keep things under control, but if you want automation — drop us a line, we'll set up a pipeline with smart rules.
NEXT STEP
Liked the approach?
We apply the same principles to client projects: AI, automation, products that don't die after launch.