Git clone supports a --sparse option
I was deploying one of my projects on my home server and I only needed the docker-compose.yml located at the top-level of the repo, not the full code. My first solution was to copy-paste it, but then I updated the file and forgot to sync it, and it bothered me.
Surprisingly, I found out that git clone supports a sparse option that by default only checks out the top-level files! To also limit what’s downloaded, you can partial clone the repo with the option --filter=blob:none.
In addition, the git-sparse-checkout command exists to grow/shrink a sparse repository.
This was a pleasant discovery, given that with AI agents, monorepos are becoming the go-to option and they may grow too big to clone in full every time.