Git子模块新版本更新
我分叉了一个MapBox-ios-sdk并对其进行了一些更改。 sdk的更新版本在这里,我将我的更改合并到我的fork中。 MapBox-ios-sdk也包含了SMCalloutView,它是MapBox-ios-sdk中的子模块。 然而,官方sdk的版本使用了一个更新的,更新的SMCalloutView,它不在我的分支中。
我如何得到它来更新
我用这里的指令更新我的SDK。 但是,这不会更新SMCalloutView。 我也试过git submodule update --recursive
- 在MapBox-ios-sdk的级别递归,并没有任何反应。 事实证明,这是因为SMCallOutView处于“无分支”状态。 为什么在“没有分支”? 我如何使所有子模块脱离“不分支”的状态? 如果它位于“无分支”,那么我永远不会知道需要更新的子模块的哪个子模块或子模块(甚至更多嵌套)。
使用git 1.8.2+(2013年3月),您可以定义一个子模块,它将反映给定分支的最新提交。
请参阅“git submodule tracking latest”。
这意味着这足以将子模块更新为最新的分支:
# --remote will also fetch and ensure that
# the latest commit from the branch is used
git submodule update --remote
有关--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子模块:指定分支/标签 ”