Git子模块到子文件夹 [英] Git Submodule to a subfolder

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

问题描述

在svn中,您可以将存储库链接到另一个svn存储库中的任何文件夹。我想知道git是否有类似的功能?基本上我想在我的仓库里有一个git子模块,但是我希望子模块是指向另一个git仓库的子文件夹的指针,而不是整个仓库。这可能吗?

解决方案

Git不支持部分签出,所以 submodule 必须指向一个完整的存储库。

Git邮件列表中的这个线程提供了一些背景信息。



来自Panther Software的这篇文章提供了其他人试图实现类似目标的一些见解(例如,使用Git复制 svn:externals )。



如果两个项目都在您的控制之下,那么我建议您将您感兴趣的子文件夹分离为其独立的回购。然后这两个项目都可以创建链接到它的子模块。


In svn you can link a repository to any folder in another svn repository. I'm wondering if there is a similar feature for git? Basically I want a git submodule inside my repository, but I want the submodule to be a pointer to a subfolder of another git repository, not the whole repository. Is this possible?

解决方案

Git does not support partial checkouts, so the submodule must point to a complete repository.

This thread on the Git mail list provides some background information.

This article from Panther Software offers some insight from someone else trying to accomplish a similar goal (i.e. replicate svn:externals using Git).

If both projects are under your control, then I suggest you isolate the "subfolder" that you interested in to its own standalone repo. Then both projects can create submodules that link to it.

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

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