A CI job clones a 10 GB repo on every run and takes 8 minutes. How do you speed it up?
IntermediateScenarioRemotes, Collaboration and Pull Requests
Answer
Situation read → CI rarely needs full history.
What I'd do →
- Shallow clone:
git clone --depth 1 --branch main URL. In GitHub Actions,actions/checkoutdefaults tofetch-depth: 1. - Skip file contents until needed:
git clone --filter=blob:none(partial clone). - Limit the tree with
git sparse-checkout set services/api. - Cache the repo between runs on persistent runners.
Why → Less data transferred means less time. Only jobs that need history (changelogs, git describe, bisect) set fetch-depth: 0.
Interview tip → Mention the blob-less partial clone for large monorepos.
More on Remotes, Collaboration and Pull Requests
You are new to a team. How do you collaborate daily without stepping on others' toes?BeginnerYou are migrating a repo from Bitbucket to GitHub and must keep every branch and tag.IntermediateYou want to contribute a fix to an open-source project you do not have write access to.BeginnerA teammate sent a 3,000-line PR and nobody can review it properly.IntermediateA reviewer asks for changes. How do you update the PR cleanly?BeginnerYour team wants stacked PRs so that large work arrives in small reviewable steps. How do you set it up?Advanced