How to git clone a specific tag only without getting the whole repo?

I want to get linux kernel 2.6.22.19 source for cross-compiling stuff for my router, but the repo is huge (3gb) if I do

git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 

and then check this tag, the clone took forever, my bandwidth is limited.

if i run this

 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git --branch v2.6.22.19 --single-branch 

an extracted file of about 150 mb in size is the right way to do this, what does this likne command mean? v2.6.22.19 is the tag name? why can he sleep after --branch?

after cloning.

 [ oglop@localhost linux-stable]$ git status # Not currently on any branch. 
+5
source share
1 answer

providing v2.6.22.19 is the tag name, and git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git is the repository URL, try the following:

 git clone --depth 1 --single-branch --branch v2.6.22.19 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 

--depth 1 only load the latest commit in the branch, this will also help with size issues

+10
source

Source: https://habr.com/ru/post/1244951/


All Articles