Proposal: Make destructive edits actually destructive in git repos

Resolved 💬 2 comments Opened Sep 11, 2025 by searls Closed Nov 28, 2025

Codex CLI feels overly conservative about removing code. Even with explicit prompts like “delete X entirely; no placeholders/comments,” it often:

  • Inserts placeholder comments (e.g., <!-- removed: … -->, // removed: …).
  • Leaves commented‑out code instead of deleting it.
  • Writes timestamped backup files on overwrite.

In git‑first workflows these safeguards create noisy diffs and stale breadcrumbs. Git already provides history/undo; the extra artifacts are detritus to be dealt with by the developer or by Codex in follow-up requests.

I figured I'd make a request here, because Codex (apparently) has really good defaults around git hygiene in its system prompt, wherein it generally won't start doing git operations like commits and pushes without being explicitly told to. As a result, addressing this in Codex feels appropriate.

Please either make this behavior configurable or relax it automatically when Codex is operating inside a git repo.

View original on GitHub ↗

2 Comments

acpoppe · 11 months ago

This seems to be a duplicate of #3420

searls · 11 months ago

The example stated is related, but the title and thrust is that Codex doesn't read AGENTS.md, which—given months of seeing the Claude Code user community cycle endlessly on that question alone—is a separate and very broad problem in its own right.

My point here is that I don't believe Codex would be behaving this way if not for system prompts built in to avoid catastrophic deletion, and I think those should be adjusted or removed in the presence of version control.