While you have to checkout a repository, you can skip checking out any files with --no-checkout
and --depth 1
:
$ time git clone --no-checkout --depth 1 https://github.com/torvalds/linux .
Cloning into '.'...
remote: Enumerating objects: 75646, done.
remote: Counting objects: 100% (75646/75646), done.
remote: Compressing objects: 100% (71197/71197), done.
remote: Total 75646 (delta 6176), reused 22237 (delta 3672), pack-reused 0
Receiving objects: 100% (75646/75646), 201.46 MiB | 7.27 MiB/s, done.
Resolving deltas: 100% (6176/6176), done.
real 0m46.117s
user 0m13.412s
sys 0m19.641s
And while there is only a .git
directory:
$ ls -al
total 0
drwxr-xr-x 3 root staff 96 Dec 26 23:57 .
drwxr-xr-x+ 71 root staff 2272 Dec 27 00:03 ..
drwxr-xr-x 12 root staff 384 Dec 26 23:58 .git
you can get a directory listing via:
$ git ls-tree --full-name --name-only -r HEAD | head
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Documentation/.gitignore
Documentation/ABI/README
or get the number of files via:
$ git ls-tree -r HEAD | wc -l
71259
or get the total file size via:
$ git ls-tree -l -r HEAD | awk '/^[^-]/ {s+=$4} END {print s}'
1006679487