Skip to content

Shadow branch commit extremely slow in repos with git LFS files #433

@jordanstern

Description

@jordanstern

Problem

The entire hooks claude-code stop hook takes ~63 seconds in a repo with git LFS files. The time is almost entirely CPU-bound (56s user time), spent hashing/staging files for the shadow branch commit.

Environment

  • Entire CLI 0.4.5 (a92c0d0)
  • macOS, Apple Silicon (darwin/arm64)
  • Git repo with 874 files, 509 of which are LFS-tracked (.dwg, .pdf, .tif, .kmz, .zip, .bin, .gpkg, etc.)
  • .git/lfs directory is ~11GB
  • Strategy: manual-commit

Reproduction

# Normal git operations are fast (33ms) because they use LFS pointer files
time git status  # 0.033s

# But the stop hook takes over a minute
echo '{"transcript_path":"/tmp/transcript.json"}' | time entire hooks claude-code stop
# 56.30s user 3.32s system 94% cpu 1:02.90 total

Root Cause

The shadow branch commit stages and hashes the entire working tree — all 874 files including all LFS-tracked binaries. The git object hashing of large binary files (satellite imagery PNGs up to 15MB, DWG files, shapefiles, etc.) accounts for nearly all of the 56 seconds of CPU time.

Normal git operations stay fast because they work with tiny LFS pointer files, but the shadow branch commit appears to process actual file contents.

Suggested Fixes

  • Skip LFS-tracked files in shadow branch commits (or only commit pointer files)
  • Support .entireignore to let users exclude large binary directories
  • Incremental staging — only git add files that actually changed during the session, rather than re-staging everything

.gitattributes

*.dwg filter=lfs diff=lfs merge=lfs -text
*.kmz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.tif filter=lfs diff=lfs merge=lfs -text
*.mms filter=lfs diff=lfs merge=lfs -text
*.dxf filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.gpkg filter=lfs diff=lfs merge=lfs -text

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions