I work at a company with a large monorepo and right now it takes ~45s to checkout the repo in CI, which is slower than I’d like.
I’ve already done what I can to optimize the git commands, both of the following techniques give about the same result and are faster than everything else I’ve tried:
git init
git remote add origin $REPO
git fetch --depth 1 origin $COMMIT_HASH
git checkout FETCH_HEAD
or
git clone --depth=1 --single-branch $REPO
I assume there’s something about my repo that is slow, because using the same techniques I can checkout facebook/react
in < 3 seconds.
Is there some way I can profile git
and get a report on why these operations are slow and what I could do about it?