如何从子树仓库中提取子模块? [英] How to pull submodules from a subtree repo?

查看:71
本文介绍了如何从子树仓库中提取子模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一个外部库作为子树.但是这个库包含一个子模块,我不知道如何获得它.

I want to add an external lib as a subtree. But this lib contains a submodule and I can't figure out how to get it.

我通常通过添加远程来手动添加子树并使用:

I usually add a subtree manually, by adding a remote and use:

git read-tree --prefix=remote -u remote/master

有人处理过子树中的子模块吗?

Has anyone ever dealt with submodules in subtrees ?

谢谢

推荐答案

据我了解,该库在 library 树的顶部具有文件.gitmodules.如果将lib作为子树包含在超级项目中,则文件.gitmodules在子树中,而git则将其放在存储库的顶部.

As far as I understand the library has file .gitmodules at the top of the library tree. When the lib is included as a subtree in a superproject the file .gitmodules is in the subtree while git expects it at the top of the repository.

我可以想到一些解决该问题的方法(符号链接,复制),但是对于这种情况,我的建议是完全避免使用子树.无论如何,您都必须使用子模块,因为lib包含一个子模块,那么为什么不将这个lib变成一个子模块而不是一个子树呢?

I can think of a few ways to work around the problem (symlink, copy) but my recommendation for this situation is to avoid subtree at all. You have to work with submodules anyway as the lib contains a submodule so why not make the very lib a submodule instead of a subtree?

这篇关于如何从子树仓库中提取子模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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