15

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?

2
25

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:

git clone --depth 1 ...

or if you want a specific date,

git clone --shallow-since=...

You can combine that with a specific branch or tag to only download that branch's tip or that tag:

git clone --depth 1 --branch v4.10-rc4 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-4.10-rc4

This produces a tree using 947MiB (and a 159MiB download).

6
  • git branch --remote origin/HEAD -> origin/master origin/master
    – Israr
    Jan 19 '17 at 10:04
  • i want the latest release which is 4.10.rc4.what to do with git , to get that.
    – Israr
    Jan 19 '17 at 10:06
  • This is working only downloading 60705 object . I think i got the answer.git clone --depth 1 --branch v4.10-rc4 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-4.10-rc4.Thank you all.
    – Israr
    Jan 19 '17 at 10:26
  • @StephenKitt Technically every repo each kernel developer has is it's own branch, so yes the kernel does use branches. Looking at git.kernel.org there are a few of them... with GregKH having 10 public ones just himself. What you will not see, is live branches in the primary repo (git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git) created with the git branch command, just all merged back into the default branch of those repositories.
    – ewanm89
    Feb 7 at 2:15
  • @ewanm89 yes, I was referring to the result of the clone shown in the first comment that’s left here (IIRC there were other comments which have since been deleted). Feb 7 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.