A huge repo makes `git status` and `git log` slow. What do you tune?
AdvancedScenarioScale, Submodules, LFS and GitHub Automation
Answer
Situation read → Large trees and many packfiles slow down core commands.
What I'd do →
- Enable background maintenance:
git maintenance start. - Write the commit graph:
git commit-graph write --reachable --changed-paths. - Turn on
core.fsmonitor=trueandcore.untrackedCache=true; considerfeature.manyFiles=true. - Repack and tune:
git repack -adf --depth=50 --window=250; check withgit count-objects -vH. - Diagnose hot spots with
GIT_TRACE2_PERF=1 git status.
Why → Commit-graph and fsmonitor avoid walking everything each time.
Interview tip → Measure first with GIT_TRACE2_PERF, then tune.
More on Scale, Submodules, LFS and GitHub Automation
A monorepo has 4 GB of history and developers only touch one service. How do you make their day-to-day faster?IntermediateDesigners commit PSD and video assets, and the repo keeps growing. How do you move them to Git LFS?IntermediateYour GitHub LFS bandwidth quota is exhausted and CI pulls fail. What do you do?AdvancedA repository uses a submodule. How does a developer get the right version of it?BeginnerSubmodules, subtree or a package manager for sharing code between repos?IntermediateCI cannot clone a private submodule: authentication fails in `actions/checkout`.Intermediate