Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to selectively clone a git repository

I am new to Git. I want to clone a large remote repository lets say xyzcodebase. The structure of repo is like I have src folders for different functional areas as shown below.

xyzcodebase
|
|__ Func area 1
|
|__ Func area 2

I work on Functional area 2 hence while cloning I don't want code from Functional area 1 (large size) which will save lots of my time. So that after cloning I will have only Functional area 2 source code on my local repository.

Is there a way to accomplish such selective cloning of git repository?

Thanks in advance for your help

like image 742
Vaman Kulkarni Avatar asked Aug 18 '11 12:08

Vaman Kulkarni


1 Answers

No, there is no way to only clone one directory. Git stores history as changes to whole repository instead of storing only subtrees as SVN.

If your project contains multiple functionalities, then maybe it would be better to split it into some sub-projects, with different repositories, and then include other repositories as submodules in master project. But it depends how your project is organized.

like image 72
MBO Avatar answered Oct 02 '22 11:10

MBO