Git子模块新版本更新 [英] Git submodule new version update

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

问题描述

我分叉了一个MapBox-ios-sdk并对其进行了一些更改。 sdk的更新版本在这里,我将我的更改合并到我的fork中。 MapBox-ios-sdk也包含了SMCalloutView,它是MapBox-ios-sdk中的子模块。然而,官方sdk的版本使用了一个更新的,更新的SMCalloutView,它不在我的分支中。



如何更新它



我使用来自此处的说明更新我的sdk。但是,这不会更新SMCalloutView。我也在MapBox-ios-sdk的级别上尝试了 git submodule update --recursive ,但没有任何反应。事实证明,这是因为SMCallOutView处于无分支状态。为什么在没有分支?我如何使所有子模块脱离不分支的状态?如果它位于no branch,那么我永远不会知道需要更新的子模块的哪个子模块或子模块(或甚至更多嵌套)。 div>

使用 git 1.8 .2+ (2013年3月),您可以定义一个子模块,它将反映给定分支的最新提交。

请参阅 git submodule tracking latest



这意味着这足以将子模块更新为最新的分支: / p>

 #--remote也将获取并确保
#使用分支的最新提交
git submodule update --remote

请参阅 git repo commit 06b1ab 了解更多 - 远程选项。






重述:


  • 对于一个新的子模块(它必须遵循一个分支)

      git submodule add -b [branch] [URL] [DirectoryName] 


  • 对于您现在需要的现有子模块关注分行

    另请参阅 git repo commit b92892 ,用于将git子模块转换为分支之后的子模块。

    您需要做的只是:

      git config -f .gitmodules submodule。< path> .branch< branch> 

    详情请参阅 Git子模块:指定分支/标记

  • I had forked a MapBox-ios-sdk and make some changes to it. A newer release of the sdk is here and I merged my the changes into my fork. MapBox-ios-sdk also incorporate SMCalloutView which is a submodule within MapBox-ios-sdk. However the version of the official sdk uses a newer, updated SMCalloutView that's not in my fork.

    How do I get it to update

    I update my sdk with instructions from here. However this does not update SMCalloutView. I also tried git submodule update --recursive at the level of the MapBox-ios-sdk and nothing happens. As it turns out it's because SMCallOutView is in "no branch". Why is it at "no branch"? How do I bring all the submodule out of the state of "no branch"? If it's at "no branch" then I'd never know which submodule or submodule of the submodule (or even more nested) that needs update.

    解决方案

    With git 1.8.2+ (March 2013), you can define a submodule which will reflect the latest commit of a given branch.
    See "git submodule tracking latest".

    It means this would be enough to update a submodule to the latest of a branch:

    # --remote will also fetch and ensure that
    # the latest commit from the branch is used
    git submodule update --remote
    

    See git repo commit 06b1ab for more on the --remote option.


    To recap:

    • For a new submodule (which must follow a branch):

      git submodule add -b [branch] [URL] [DirectoryName]
      

    • For an existing submodule that you now want it to follow a branch:
      See also git repo commit b92892, for transforming a git submodule into one which follows a branch.
      All you need to do is:

      git config -f .gitmodules submodule.<path>.branch <branch>
      

      See more at "Git submodules: Specify a branch/tag"

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

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