The Error
You open a project in VS Code and the Source Control panel greets you with this:
The git repository at 'path' has too many changes. Only a subset of Git features will be enabled.
The Source Control badge freezes. File diffs stop loading. The Git status bar at the bottom becomes a lie. VS Code's built-in Git extension has a hard ceiling of 10,000 files. Hit that limit and it deliberately backs off to protect editor performance โ leaving you with a half-broken source control panel.
Why It Happens
Nine times out of ten, it's one of these:
node_modules/,.venv/,dist/, or build output folders missing from.gitignore- A large generated file tree got accidentally staged or left untracked
- You opened a monorepo root containing many nested Git-tracked subprojects
- A syntax error in
.gitignoresilently stopped all pattern matching
Step-by-Step Fix
Step 1 โ Count how many files Git actually sees
Run this from the project root:
git status --porcelain | wc -l
If the output is in the tens of thousands, you've found your culprit: a missing or broken .gitignore. A healthy project typically shows under 50 changed files during active development.
Step 2 โ Fix your .gitignore
Add the usual noise folders to .gitignore:
# Node
node_modules/
dist/
.next/
build/
# Python
.venv/
__pycache__/
*.pyc
# Java / Gradle / Maven
target/
.gradle/
# General
*.log
.DS_Store
Thumbs.db
.env
Saving the file isn't enough โ Git has already indexed those paths. Clear its cache:
git rm -r --cached .
git add .
git status --porcelain | wc -l
That file count should collapse from tens of thousands down to double digits. Before committing anything, run git status and confirm the list looks sane.
Step 3 โ Raise VS Code's file limit (optional)
Got a legitimate reason to track many files โ say, a large generated dataset you intentionally version? Raise the threshold in .vscode/settings.json:
{
"git.repositoryScanner.maxFileCount": 50000
}
Or kill the warning entirely if you manage Git outside VS Code:
{
"git.ignoreLimitWarning": true
}
Step 4 โ Raise the inotify limit (Linux only)
Linux systems use inotify to watch files for changes. The default ceiling is often too low for large projects. Check it and bump it up:
# Check current limit
cat /proc/sys/fs/inotify/max_user_watches
# Raise it temporarily
sudo sysctl fs.inotify.max_user_watches=524288
# Make it permanent across reboots
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
Step 5 โ Stop VS Code from watching noisy folders
A correct .gitignore handles Git. But VS Code has its own file watcher for IntelliSense โ and it doesn't care about .gitignore. Tell it explicitly what to ignore:
{
"files.watcherExclude": {
"**/node_modules/**": true,
"**/.venv/**": true,
"**/dist/**": true,
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true
},
"files.exclude": {
"**/node_modules": true,
"**/__pycache__": true
}
}
Verify the Fix
- Reload VS Code: Ctrl+Shift+P โ Developer: Reload Window
- Check the Source Control panel โ the warning banner should be gone
- The Git badge should now show the correct changed-file count
- Run
git statusin the terminal and confirm the list is reasonable
Quick Tips
- Monorepos: opening the repo root means VS Code counts every file across all sub-packages. Open a specific sub-folder instead if you're only working in one area.
- Git submodules: VS Code counts submodule files toward the total. Set
"git.detectSubmodules": falseto opt out if you don't need submodule integration. - Global .gitignore: stop re-adding
.DS_StoreandThumbs.dbto every project. Put them in a global ignore file once:git config --global core.excludesfile ~/.gitignore_global - After
git rm -r --cached ., rungit diff --cached --name-only | head -20before committing โ just to make sure nothing important got accidentally unstaged.

