Estimate git fetch duration based on new commits, objects and network conditions.
Unlike a clone, a fetch only transfers objects the remote has that your local repository lacks. Formula: time = delta_objects × avg_object_size / bandwidth. Delta object count grows with how long it's been since your last fetch and how active the branches you're tracking are, so frequent fetches keep this number — and the time it takes — small.
fetch_time_sec = (delta_objects × avg_object_size_KB) / (bandwidth_Mbps × 1000 / 8)
If you haven't fetched in a long time, or if someone pushed large binary blobs, the delta object count and average object size both spike, increasing transfer size well beyond a typical incremental sync.
Yes — each ref you track adds its own delta objects. Fetching a single feature branch is far cheaper than `git fetch --all` on a repo with hundreds of branches.
Use a persistent clone/cache between CI runs so each fetch is incremental rather than a fresh clone, and consider `git fetch --filter=blob:none` if you don't need full blob history for the fetch step.
Yes — the server needs to compute the pack of missing objects to send you, which adds CPU-bound time on top of the pure network transfer this calculator models.