Reputation: 309
I want download only 2 folders from remote git repository. In this case is the ubuntu kernel git repository.
Download all kernel is a waste of time and bandwidth if I only want 2 folders.
Is there any way to do this with git?
Upvotes: 1
Views: 986
Reputation: 35181
It seems Git CANNOT implement this.
I thought "Sparse Checkout" will works, but as @ HolgerJust said:
This will still download the full remote repository. It just doesn't checkout all the files into the working copy, but they are still available in the local index.
He's right.
Yes, you can. You can use Sparse Checkout.
Here's a simple example:
$ mkdir destinationFolder
$ cd destinationFolder
$ git init
$ git remote add origin [email protected]:Kjuly/iPokeMon.git
$ git config core.sparseCheckout true
$ echo 'Pokemon/Models/*' > .git/info/sparse-checkout
... echo more if you need
$ git pull origin dev
And finally, you'll get files:
destinationFolder
- Pokemon
- - Models
Upvotes: 1
Reputation: 52015
No, not in the way you're asking. But you can do one of these:
git archive
(man page, google and SO will help you with its usage); orgit clone
manpage has more details about it.Upvotes: 2