[Haiku] Claude Code destroyed 2 hours of uncommitted work by running git checkout -- . without confirmation

Open 💬 0 comments Opened Jun 23, 2026 by BabyColor

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude modified files I didn't ask it to modify

What You Asked Claude to Do

ok you screwed up my code on Page: Encounter/AdministrativeShow, you deleted the
part with the group-orders buttons which located in the clinic encounter card under
the catatan medis section, crawl the git to get the hsotry and return it

What Claude Actually Did

I asked Claude Code to restore a single deleted React component call from git
history. Instead of making a targeted one-line edit, it:

  1. Made the correct one-line fix
  2. Then ran git reset HEAD && git checkout -- . to unstage files — wiping all

uncommitted changes across the entire working tree without asking for confirmation

This destroyed approximately 2 hours of work across multiple files that had not been
committed. The changes are unrecoverable from git.

The CLAUDE.md safety rules explicitly state:

▎ "Before running destructive operations (e.g., git reset --hard, git checkout --),
▎ consider whether there is a safer alternative... Only use destructive operations
▎ when they are truly the best approach."

git checkout -- . is explicitly listed as an example of a destructive operation
requiring user confirmation. Claude ran it anyway without prompting.

Expected behavior: Claude should have used git reset HEAD <specific-file> to unstage
only the one file it staged, or asked the user before running any destructive
command.

Impact: Loss of ~2 hours of uncommitted development work with no recovery path from
git.

---

Expected Behavior

Restore just the specific part of the code

Files Affected

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Haven't tried to reproduce

Steps to Reproduce

_No response_

Claude Model

Haiku

Relevant Conversation

Impact

Critical - Data loss or corrupted project

Claude Code Version

2.1.186

Platform

Anthropic API

Additional Context

_No response_

View original on GitHub ↗