Why Is Git Status Taking So Long [Solved]

Symptoms & Diagnosis

When you run git status, you expect an immediate response. However, in large monorepos or repositories with thousands of untracked files, the command may hang for several seconds or even minutes.

Common symptoms include high CPU usage by the git process and significant disk I/O. This lag occurs because Git must scan the entire working directory to compare file metadata against the index.

To diagnose the exact cause, you can use Git’s built-in performance tracing tool. This reveals which part of the process is causing the delay.

GIT_TRACE2_PERF=1 git status

Developer experiencing a slow git status response in a high-tech terminal environment.

Troubleshooting Guide

Once you identify the bottleneck, you can apply specific configuration changes to speed up the index refresh. The most common cause is the sheer volume of files on the disk.

Optimization Benefit Command
FSMonitor Uses OS events to track changes instead of scanning disk. git config core.fsmonitor true
Preload Index Parallelizes the index refresh across CPU cores. git config core.preloadIndex true
Untracked Cache Speeds up detection of new, untracked files. git config core.untrackedCache true

Handling Large Untracked Folders

If your repository contains massive folders that aren’t ignored, Git wastes time checking them. You can suppress the summary of untracked files to gain speed instantly.

git status -uno

Submodule Latency

Repositories with many submodules often experience lag because Git checks the status of every sub-project. You can disable this recursive check to improve performance.

git config status.submoduleSummary false
git config diff.ignoreSubmodules all

Prevention

Maintaining repository hygiene is the best way to prevent git status from slowing down over time. Long-term performance requires managing how Git interacts with your local hardware.

Optimize the Git Database

Over time, Git accumulates loose objects that slow down operations. Regular garbage collection packs these objects into more efficient structures.

git gc --aggressive --prune=now

Strict .gitignore Policies

Ensure that build artifacts, dependency directories (like node_modules), and temporary logs are strictly excluded in your .gitignore file. This limits the “surface area” Git has to monitor.

Use Git LFS for Large Assets

If your repository is slow due to large binary files (images, videos, or binaries), migrate them to Git Large File Storage (LFS). This keeps the main repository lightweight and responsive.

git lfs install
git lfs track "*.psd"