When I download the kernel directly as type tar.xz
, and untar it, the size is around 1GB. But when I download it via git clone
from here, the size is around 7GB. It shows only master branch. Why this huge difference?
Git Clone of Linux Kernel Source Code – Why It’s Larger Than tar.xz
linux-kernel
Best Answer
The tarball only contains the source code for the specific release of the kernel in the tarball, whereas the git repository (cloned using
git clone
) contains the history of the kernel going back quite a long time. Even if you only see the master branch when you initially clone it, using the default clone parameters you actually have the full repository locally:git log
will show you the full history,git branch --remote
will show all the available branches.If you only want the latest commit, you can use a shallow clone which will be much smaller:
or if you want a specific date,
You can combine that with a specific branch or tag to only download that branch's tip or that tag:
This produces a tree using 947MiB (and a 159MiB download).