【问题标题】:git submodules - status no matching/tracking the remotegit submodules - 状态没有匹配/跟踪远程
【发布时间】:2017-03-10 21:13:44
【问题描述】:

这是submodules 上的一篇很棒的文章,但我有一个问题可以在这里得到解答。

我在这里有我的 repo/子模块:home/submodule

然后我将它作为子模块包含在此处:home/core/submodule

但是如果我进入 home/submodule 并进行一些更改,那么到 git add、git commit、git push 就可以了。

但是如果我进入 home/core/submodule 并执行 git status ,它会说它是最新的,即使它是/应该是 1 次提交。

如果我然后留在 home/core/submodule 并执行 git pull,它会拉下更改,即使它认为没有任何更改,然后它将与遥控器保持最新。

是我做错了什么,还是我误用了子模块?

相关问题Git submodule to track remote branchGit submodules workflow
编辑 - 这里有很好的资源 https://git-scm.com/book/en/v2/Git-Tools-Submodules - 特别是在 git diff --submodule 周围,以显示子模块中的新提交。

【问题讨论】:

标签: git git-submodules


【解决方案1】:

Git 不会自动检查任何遥控器是否有新内容。只有当您执行git fetchgit pull(或git push)时,它才会与遥控器通信。

如果您首先执行git fetch,它将表明您落后于 X 次提交。

【讨论】:

  • tks,但是我可以确认一下,如果我执行 git remote -v 并且它指向 X 然后我执行 git status,那么该状态是否应该与 X 不相关?这是我对子模块的期望,但也许这是我的错误?
猜你喜欢
  • 2014-08-22
  • 2011-03-04
  • 2014-06-09
  • 2017-01-16
  • 2013-05-11
  • 2016-06-05
  • 1970-01-01
  • 2020-04-16
  • 2010-10-05
相关资源
最近更新 更多