如何从git子模块克隆一个文件夹? [英] How to clone only a folder from a git submodule?

查看:214
本文介绍了如何从git子模块克隆一个文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我希望我的项目设置如下所示:

我想从我的项目中使用一个外部github repo文件夹。 p>

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

我有一个名为some-submodule的远程仓库,其结构如下:

  -submodule 
-code.py
-README
-.gitignore


但是我结束了与此后

 git submodule添加 http://github.com/user/submodule。 git 子模块
$ b $ pre $ -my_project
-submodule
- submodule
-code.py
-README
-.gitignore
-MY_README
-.gitignore

我是git的新手,所以我真的很d不知道是否可能只使用git。如果它有一些帮助,我在Windows上使用msysgit。

那么,是否有我可以从公共回购项目中获得一个干净的子模块文件夹?

如果你对我正在尝试做的事情感到好奇,我试图直接从他们的仓库中获取这些django插件 1 2 将它们添加到我的项目中。

解决方案

你想做什么是不可行的,因为你不能克隆一部分存储库。

详细信息请参见如何将git子模块更改为指向子文件夹?


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.

解决方案

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?

这篇关于如何从git子模块克隆一个文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆