How a One-line Change Decreased Our Build Times by 99%
Article Summary
About This Article
Problem
Pinterest's CI pipelines were pulling all 2,500+ branches from their Pinboard monorepo during checkout, even though the repo was 20GB with 350K+ commits. They had already tried shallow clones and limiting commits to the last 50, but it wasn't enough.
Solution
The Engineering Productivity team fixed it by adding a refspec parameter to their Git fetch config. Instead of fetching all branch refs with +refs/heads/*:refs/remotes/origin/*, they specified only the master branch.
Impact
Clone times for Pinboard dropped from 40 minutes to 30 seconds. That's a 99% reduction. With 60K+ daily git pulls running through their CI pipelines, the faster builds made a real difference.