Claude Code's Silent Git Reset Bug: Every 10 Minutes, Your Work Vanishes
#Vulnerabilities

Claude Code's Silent Git Reset Bug: Every 10 Minutes, Your Work Vanishes

Startups Reporter
2 min read

A critical bug in Claude Code 2.1.87 automatically runs git reset --hard origin/main every 10 minutes, silently destroying uncommitted changes in tracked files.

A critical bug in Claude Code 2.1.87 is destroying developer work across macOS systems, automatically running git reset --hard origin/main every 10 minutes and silently wiping out all uncommitted changes to tracked files.

The Problem

Users report that Claude Code performs git fetch origin + git reset --hard origin/main on their project repositories every 10 minutes through programmatic git operations—no external git binary is spawned. The operations target the main working tree only, leaving git worktrees immune and untracked files surviving.

Evidence and Reproduction

The bug manifests through several clear indicators:

  • Git reflog analysis: 95+ entries at exact 10-minute intervals show reset: moving to origin/main operations
  • Live reproduction: Modified tracked files (like src/lib/api.ts) are silently reverted at the next 10-minute mark, while untracked files survive
  • Process monitoring: Only the Claude Code CLI process is active in the affected repository directory
  • File system watching: fswatch captures the classic pattern of git fetch operations through lock file creation

Impact on Development

During a typical 2-hour coding session, developers must re-apply changes 3+ times before identifying the cause. The bug appears intermittent when all changes are committed (since the reset becomes a no-op), making diagnosis difficult.

What's Been Ruled Out

Extensive investigation has eliminated external causes:

  • Git hooks (all cleared)
  • Plugin marketplace updater (deleted without effect)
  • macOS cloud sync tools
  • Cron/LaunchAgents
  • Development servers (Vite/SvelteKit)
  • IDEs and editors
  • Time Machine snapshots
  • File watchers

Workarounds

Developers have identified temporary solutions:

  • Use git worktrees: Confirmed immune to the reset operations
  • Commit frequently: Committed changes survive the automatic resets

Technical Analysis

The compiled binary analysis reveals:

  • hg1() function performs git fetch origin operations
  • io1() function is a git pull wrapper
  • fileHistory state tracks snapshots and tracked files
  • The exact timer/setInterval setup remains unidentified in minified code

Community Response

This issue has been classified as a critical data-loss bug. The Claude Code team has closed the investigation as "not planned," with maintainer Jarred-Sumner suggesting the behavior might stem from --dangerously-skip-permissions mode allowing shell commands to execute without prompts when prompted by interval-based operations.

This bug connects to several other reported problems:

The issue specifically affects macOS 15.4+ systems running Claude Code 2.1.87 via Homebrew cask with the compiled Bun binary.

For developers using Claude Code on macOS, this represents a significant workflow disruption until a permanent fix is deployed.

Comments

Loading comments...