Reputation: 31548
I am new to using Git and now i am trying on my repositories.
I have a repository where I have put many folders in it.
Now in my new project, I want to grab specific folders from that repository.
Can I do that in Git? I have uploaded my repo to BitBucket.
Upvotes: 1
Views: 127
Reputation: 70663
What you want is possible via sparse checkout, something I have explained in this answer: https://stackoverflow.com/a/13738858/758345.
But we warned: You are probably doing something wrong if you need this feature. You should probably gives us more information about your circumstances and what you are trying to achieve.
Upvotes: 1
Reputation: 1323573
If you really need only certain directories, you should declare them as submodule of your main git repo.
That way, those directories are in their own git repo, and you can clone them independently of the parent repo.
Otherwise, what you want is called sparsed checkout (as opposed to shallow clone, which clone part of the history of the all repo), and, as mentioned in "Partial clone with Git and Mercurial", wasn't possible with Git.
Git1.7.0 includes it with git read-tree
(but you still need to clone the full repo).
See "Sparse checkout in Git 1.7.0?" for a script.
"clone parts of a github project" mentions other options.
Upvotes: 2