Comment by dietr1ch
15 hours ago
I just tried 2hrs and it only uses 375M
git clone \
--single-branch \
--shallow-since '-2 hours' \
--origin 'upstream' \
gh:NixOS/nixpkgs
What's annoying later is that you MUST remember to always use shallow fetch and hard resets into upstream/$BRANCH
git fetch \
--shallow-since '-2 hours' \
upstream \
master nixos-unstable
Interesting, I have taken a stab at maintaining a repo on the nixpkgs and using a --sparse approach, i.e. `git clone --filter=blob:none --sparse --branch nixos-25.11 https://github.com/NixOS/nixpkgs.git nixpkgs-dorion cd nixpkgs-dorion`
I have a non-shallow clone and the .git directory is less than 3GB.
Oh, maybe I had a full clone on my laptop before I started doing shallow fetches, but since fetching takes quite a while I've been using a shallow clone on my workstation.