how to clone specific folder from git using --sparse

5.6k views Asked by At

git version 2.25.1

I'm trying to clone only a specific directory from the git repository using the below command ;

git clone --depth 1 --filter=blob:none --sparse https://github.com/gitexpert/testGithub.git
cd testGithub
git sparse-checkout set banana

I'm getting this output:

hello.rb
readme.text
test.md

but the expected output should be :

I want to clone only the root folder banana not the one from the src folder.

enter image description here

also, how do I pull the local copy up-to-date with the remote repository?

0

There are 0 answers