What is the effect of Git clone size and strategy on CI time, and how do you reduce it?
BeginnerProductionMetrics, Performance and Cost
Answer
Cloning large histories can take minutes. Use shallow clones (fetch-depth: 1 or GIT_DEPTH), partial clone (--filter=blob:none), sparse checkout for monorepos, local reference mirrors on persistent agents, and git fetch into a reused workspace on static agents. Remember that tools needing history (changelogs, SonarQube blame, git describe) need a deeper fetch, so make it explicit in those jobs only.
git clone --depth 1 --filter=blob:none --sparse https://github.com/acme/monorepo.git
git sparse-checkout set services/payments
More on Metrics, Performance and Cost
How do you measure DORA metrics in practice?IntermediateWhat do the DORA performance levels look like, and how do you use them?IntermediateWhat are common ways DORA metrics get gamed or misread?AdvancedWhich pipeline metrics do you monitor for the CI platform itself?IntermediateHow do you cut CI cost without hurting developer speed?IntermediateHow do you use a remote build cache (Gradle, Bazel, Turborepo, Nx)?Advanced