Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TortoiseGit how to clone a folder structure

Tags:

tortoisegit

I do not want to clone the whole repository. We have a repository that is 300 MB, and I just only want the folder called /sourcecode, instead of downloading the whole root folder.

Is there a way to do this?

like image 972
user1929393 Avatar asked Apr 05 '13 04:04

user1929393


People also ask

Can I Git clone a folder?

Go to the current directory where you want the cloned directory to be added. To do this, input cd and add your folder location. You can add the folder location by dragging the folder to Git bash. Click on “Clone or download” and copy the URL.

How do I clone a folder?

To clone git repository into a specific folder, you can use -C <path> parameter, e.g. Although it'll still create a whatever folder on top of it, so to clone the content of the repository into current directory, use the following syntax: cd /httpdocs git clone [email protected]:whatever .

How do I clone a repository with Tortoise?

To clone a repository you have to run the clone dialog. From the explorer context menu select TortoiseHg… ‣ Clone a repository or type thg clone. It is the path (or URL) of the repository that will be cloned. Use the Browse… to choose a local folder.

Does cloning a repo create a folder?

Clone to a FolderBy default, a folder is created with the same name as the repository we cloned. In our first example, we cloned a repository without specifying a folder name.


1 Answers

The feature itself is not yet available for TortoiseGit: see issue 1599 (January 2013).

So it should be a simple checkout, except you need to edit first .git/info/sparse-checkout, as describe in "Is it possible to do a sparse checkout without checking out the whole repository first?".

Be aware that it is still buggy with msysgit1.8.1 though. See "Why does git sparse checkout leave behind directories?".

like image 56
VonC Avatar answered Sep 19 '22 07:09

VonC