Claude Code runs git reset --hard origin/main every 10 minutes, destroying uncommitted changes
Summary
Claude Code's internal checkpoint/file-history-snapshot system performs git reset --hard origin/main on the main working tree every 10 minutes, silently destroying all uncommitted changes to tracked files. This was confirmed via 90+ git reflog entries at exact 10-minute intervals and reproduced live.
Environment
- Claude Code version: 2.1.87
- OS: macOS 15.4 (Darwin 25.3.0)
- Shell: zsh
- Node: v22.x
- Git: 2.x
Reproduction Steps
- Start a Claude Code session in a git repo with a remote
- Edit a tracked file (e.g., via the Edit tool or manually)
- Do not commit
- Wait 10 minutes
- Run
git status— the modification is gone - Run
git reflog --date=iso | head -5— you'll seereset: moving to origin/main
Untracked files (new files not yet git add-ed) survive. Only tracked file modifications are destroyed.
Evidence
Git reflog shows exact 10-minute intervals
e8ea2c9 HEAD@{2026-03-29 22:19:09 +0200}: reset: moving to origin/main
e8ea2c9 HEAD@{2026-03-29 22:09:09 +0200}: reset: moving to origin/main
e8ea2c9 HEAD@{2026-03-29 21:59:09 +0200}: reset: moving to origin/main
e8ea2c9 HEAD@{2026-03-29 21:49:09 +0200}: reset: moving to origin/main
e8ea2c9 HEAD@{2026-03-29 21:39:09 +0200}: reset: moving to origin/main
e8ea2c9 HEAD@{2026-03-29 21:29:09 +0200}: reset: moving to origin/main
90+ such entries were found across 4 sessions over ~36 hours. The second offset is consistent within each session but varies between sessions (:08, :36, :41, :09), confirming a setInterval(fn, 600000) tied to session start time.
Live reproduction
- Modified
src/lib/api.ts(tracked file) and created.canary-test.txt(untracked file) - Monitored every 15 seconds
- At the next 10-minute mark,
api.tssilently reverted to clean state .canary-test.txt(untracked) survived- Reproduced consistently across 4 consecutive 10-minute cycles
Mechanism is internal to the Node.js process
fswatchon.git/detected lock file operations (.git/refs/remotes/origin/HEAD.lock,.git/refs/heads/main.lock) at exact reset times- No external
gitbinary was spawned — process monitoring at 0.1-second intervals found zerogitprocesses around reset times - This indicates programmatic git operations (likely libgit2 or similar) within the Claude Code Node.js process
- Session JSONL files contain
file-history-snapshotentries withtrackedFileBackupsandisSnapshotUpdate: Truefields
Git worktrees are immune
The worktree reflog shows zero reset: moving to origin entries. The periodic reset targets the main working tree only.
Impact
Any uncommitted changes to tracked files in the main working tree are silently destroyed every 10 minutes. This caused significant rework in a ~2 hour session where changes had to be re-applied 3+ times before the cause was identified.
The bug is invisible when all changes are committed (the reset is a no-op when HEAD equals origin/main), which makes it appear intermittent.
What was ruled out
A thorough investigation eliminated all external causes:
- Git hooks — all inactive (
.sampleonly) - Claude Code user hooks — audio notifications only, none reference git
- macOS mechanisms — no cloud sync, cron, LaunchAgents, or file watchers covering the project
- Vite/SvelteKit dev server — all file writes go to output directories, zero git awareness
- IDE/editors — no format-on-save, no auto-restore configured
Workaround
- Use git worktrees — confirmed immune to this bug
- Commit frequently — committed changes survive the reset
Related Issues
- #8072 — "Critical Bug: Code Revisions Being Repeatedly Reverted"
- #11169 — "Auto-Compact causes model to revert to previously rejected code patterns"
- #10948 — "Auto-compact triggers mid-task causing context loss and hallucinations"
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗