Shallow git fetch cuts Azure DevOps build times
Using `git fetch --depth=1` reduces checkout time in Azure DevOps from 3-4 minutes to approximately 1 minute reported.
Azure DevOps pipelines often default to fetching the entire Git history, even if only the latest version is needed for a build. This default behavior significantly increases the time it takes to complete the checkout process, especially for repositories with a long history. `git fetch --depth=1` creates a shallow clone, downloading only the most recent commit. This drastically reduces the amount of data transferred, leading to faster checkout times and quicker overall pipeline execution. The reported time savings of reducing checkout from 3-4 minutes to 1 minute highlights the potential impact of optimizing Git fetching strategies. For large projects or teams with frequent builds, this optimization can lead to substantial time and cost savings.