Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clone only a folder from a git submodule?

I'm trying to get just a folder from an external github repo to use in my project.

I want my project setup to be like this:

-my_project     -submodule         -code.py     -MY_README     -.git 

And I have the remote repo named some-submodule with following structure:

-submodule     -code.py -README -.gitignore 

So I just want the submodule folder added to my project.

But I end up with this after

git submodule add http://github.com/user/submodule.git submodule
-my_project     -submodule         -submodule             -code.py         -README         -.gitignore     -MY_README     -.gitignore 

I am new to git so I really don't know if it possible using just git. If it is of some help I'm using msysgit on windows.

So, is there anyway that I can get a clean submodule folder in my project from a public repo?

If you're curious of exactly what I'm trying to do I'm trying to take directly from their repos these django plugins 1 2 to add them to my project.

like image 794
demula Avatar asked Oct 05 '10 18:10

demula


People also ask

Can I clone a single folder from git?

Cloning only a subdirectory is not possible in Git. The network protocol doesn't support it, the storage format doesn't support it.

How do I clone a repository with submodules?

The list of steps required to clone a Git repository with submodules is: Issue a git clone command on the parent repository. Issue a git submodule init command. Issue a git submodule update command.


1 Answers

What you want to do is not feasible because you cannot clone a part of a repository.

See details in duplicate How to change a git submodule to point to a subfolder?

like image 181
dregad Avatar answered Sep 22 '22 19:09

dregad