Have you noticed your code disappearing every few minutes? Claude Code's scheduled Git reset might be the culprit. This automatic behavior can save you from disaster—or wreck your workflow depending on how you use it. Let's break down what's happening and how to control it.

Understanding Claude Code's Scheduled Git Reset

Claude Code automatically runs git reset --hard origin/main against your project repository at regular intervals. By default, this happens every 10 minutes during active sessions. The purpose is straightforward: protecting you from catastrophic mistakes. If you issue a destructive command or accidentally corrupt files, Claude Code can recover to a clean state.

The mechanism works by creating commit snapshots before major operations. When the reset triggers, your local branch reverts to match the remote main branch exactly. Any uncommitted changes—including work you haven't saved—disappear permanently.

// When Claude Code runs git reset --hard origin/main:
// 1. Local changes are wiped
// 2. Working directory matches remote main
// 3. HEAD points to origin/main

This safety net prevents runaway AI commands from permanently damaging your codebase. However, it also means developers must commit frequently to preserve their work.

Why the 10-Minute Interval Matters

The 10-minute window represents a balance between safety and usability. Shorter intervals would interrupt your workflow constantly. Longer intervals increase risk exposure to problematic commands. Claude Code made this default based on typical development patterns where work pauses naturally allow for checkpoint commits.

During active coding sessions, Claude Code tracks which files you're modifying. The reset clears all uncommitted work, forcing you to either commit locally or lose changes. This design choice prioritizes repository integrity over convenience.

Check your current git status before reset triggers git status

View recent commits that serve as restore points git log --oneline -10

If reset happens, recover using reflog git reflog git checkout HEAD@{1}

Understanding this timing helps you plan your workflow around critical work sections.

Configuring and Disabling the Auto-Reset

Not every project needs this aggressive protection. You can customize or disable the behavior through Claude Code's configuration options. The claude_code_config.json file controls reset frequency and conditions.

{
  "gitResetInterval": 0,
  "autoCommitEnabled": true,
  "safetyResetEnabled": false
}

Setting gitResetInterval to 0 disables automatic resets entirely. You might prefer this for personal projects, experimental branches, or environments where you handle version control manually. Some teams disable this feature when working in feature branches with regular CI/CD pipelines.

Alternatively, enable auto-commit to create checkpoints automatically before resets occur. This hybrid approach gives you protection without losing work between manual commits.

Configure custom reset interval (in minutes) export CLAUDE_GIT_RESET_INTERVAL=30

Disable entirely export CLAUDE_GIT_RESET_INTERVAL=0

Test changes in isolated branches before modifying global settings. Each project may have different safety requirements based on team size and deployment practices.

Best Practices for Working with Auto-Reset

Surviving Claude Code's auto-reset requires disciplined version control habits. Commit early and often—ideally after completing each logical unit of work. Use descriptive commit messages that help you navigate history when recovery becomes necessary.

Quick commit workflow git add . git commit -m "feat: add user authentication module"

Create backup branch before experimental work git checkout -b experiment-backup

Consider creating .claudeignore files to protect sensitive directories from reset interference. This prevents accidental clearing of generated files or build artifacts that shouldn't trigger repository-wide resets.

Pair Claude Code