Per-project option to disable git status polling (needed for large repos)

Resolved 💬 3 comments Opened Apr 18, 2026 by adelaidasofia Closed Apr 21, 2026

Problem

Claude Code polls git status and git diff --numstat in the background to populate sidebar state. On repos with 60K+ tracked files this triggers refresh-index internally, which acquires .git/index.lock for extended periods (10–60s per poll on a cold index).

When multiple Claude Code sessions close simultaneously and each tries to commit session files via git add + git commit, they queue on .git/index.lock. Under contention:

  • The second commit fails with "Another git process seems to be running in this repository."
  • If a user or script naively removes the lock during a live write, .git/index gets truncated and the repo requires manual recovery via git reset.

Request

A per-project config option to disable or throttle Claude Code's git status polling for a specific working directory. Possible shapes:

  • git.enabled: false in .claude/settings.json
  • An entry in .claude/settings.json like "git.autoRefresh": false
  • Respect core.hooksPath or an existing git config flag that signals "don't poll"

Workaround currently in use

  1. Enabled core.fsmonitor = true, core.untrackedCache = true, feature.manyFiles = true, index.skipHash = true in .git/config — reduces lock hold time significantly but doesn't stop the polling.
  2. A hardened commit script that checks lock ownership (via lsof + PID check inside the lock file), uses a vault-wide /tmp mutex, and waits up to 60s before failing loudly.
  3. Manual pkill -P <claude_pid> -f "git -c " at session start to clear leaked children.

Reproduction

  1. Open a project with 60K+ tracked files in Claude Code.
  2. Open 2+ Claude Code sessions in the same directory.
  3. Have both sessions run git add <paths> && git commit within a few seconds of each other.
  4. The second commit fails with the lock contention error.

The underlying git performance can be improved by the user (fsmonitor etc.), but the polling itself cannot be disabled, meaning the window of vulnerability is reduced but not eliminated.

Environment

  • macOS 15.x
  • Claude Code (latest)
  • Git 2.50.1 (Apple Git-155)
  • Vault: ~60K tracked markdown files, no remote

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗