【问题标题】:git clone --recursive - submodules on no branchgit clone --recursive - 没有分支的子模块
【发布时间】:2015-11-07 14:19:58
【问题描述】:

我有一个名为“production”的 git 模块和几个子模块。当我使用以下命令时:git clone --recursive git@git_server:production 它正在使用子模块克隆“生产”模块。当我在其中一个子模块中cd 并给出以下命令时:git branch -a 我得到:

* (no branch)
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

.gitmodules 文件包含:

[submodule "blabla"]
url = git@git_server:production/blabla
path = blabla
branch = refs/heads/master
...........................................

问题是:为什么如果我递归克隆子模块在分支“(无分支)”上,并且如果我只克隆相应的子模块直接克隆在分支“master”上?有没有什么办法可以改变我克隆递归时直接克隆分支“master”中的所有子模块的配置?

【问题讨论】:

    标签: git git-branch git-submodules git-clone


    【解决方案1】:

    为什么如果我递归克隆子模块在分支“(无分支)”上

    父repo直接在gitlink(special entry in the index)记录的SHA1上签出子模块

    如果您要添加一个 gitsubmodule update --recursive --remote(在您的克隆之后),那么它将进入子模块,获取并更新分支。

    See also the submodule.$name.update config.

    【讨论】:

    • 感谢您的回答!不幸的是,当我发出这个命令时,git submodule update --recursive --remote 什么也没做。问题是 git 子模块没有 --remote 标志。我正在使用 git 版本 1.7.1
    猜你喜欢
    • 1970-01-01
    • 2012-05-26
    • 1970-01-01
    • 1970-01-01
    • 2014-11-19
    • 1970-01-01
    • 2011-11-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多