【问题标题】:Checking out only a subdirectory of another repo with git-submodule使用 git-submodule 仅检出另一个 repo 的子目录
【发布时间】:2011-07-18 14:24:20
【问题描述】:

我只需要在我的“超级项目”中添加另一个项目的一部分(一个目录),所以我想知道 git-submodule 是否可以只将另一个存储库中的某个目录添加到我的项目中?

(我也在使用 git 进行部署,所以我不想在我的项目中塞满其他不必要的东西。)

【问题讨论】:

标签: git git-submodules


【解决方案1】:

您可以创建一个裸仓库,然后在 git 命令后使用 git checkout--work-tree--git-dir 参数,并指定您想要的分支/标签,然后在 -- 之后指定您想要的路径文件说明符选项。示例:

git --git-dir=somedir --work-tree=someotherdir checkout somebranchortag -- somepath

希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 2017-06-03
    • 2021-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-07
    • 2012-12-18
    相关资源
    最近更新 更多