git - 无法从 git 子模块推送提交?

标签 git github git-submodules

我有一个只有一个子模块的简单项目。

$ git submodule
 964737623a362f6303e87ec41f2c7090c8c2c093 lib/mongodb-php-odm (heads/master-1-g9647376)

我已经对该子模块进行了更改并提交了它们,但无法将它们推送到 github。

$ cd lib/mongodb-php-odm
$ git branch
* (no branch)
  master
$ git remote -v
origin  git@github.com:colinmollenhour/mongodb-php-odm.git
$ git ls-remote .
964737623a362f6303e87ec41f2c7090c8c2c093    HEAD
6f5f91eff9b1854faa30608f335aee92aa7532eb    refs/heads/master
6f5f91eff9b1854faa30608f335aee92aa7532eb    refs/remotes/origin/HEAD
6f5f91eff9b1854faa30608f335aee92aa7532eb    refs/remotes/origin/master
$ git push origin master
Everything up-to-date

我不明白为什么它说“Everything up-to-date”,因为 964737 提交还没有被推送到 github。很可能我做错了什么,但我不知道那会是什么......

如何将此子模块中的最新提交推送到 github?

最佳答案

您似乎没有提交任何分支,即您的提交不属于任何分支。在您所在的位置创建一个分支,然后启动 gitk 与 master 进行比较,然后根据需要进行 cherry-pick 或 rebase。

关于git - 无法从 git 子模块推送提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4445738/

相关文章:

git - 所有分支都是平等的吗?

git - azure devops git 分支前后但文件是相同的

github - 创建公共(public) GitHub 存储库时,处理第 3 方库的最佳方法是什么?

Git 子模块头 'reference is not a tree' 错误

没有额外重量的 Git 子模块

Git lfs 跟踪子文件夹下的所有文件

主题分支上的 Git diff,不包括同时发生的 merge 提交?

提交消息中的 Git 魔术关键字(签名人、合着者、修复等)

github - 如何重新发布之前从 github 删除的存储库?

git - 无法使用 fig/crane 在 Docker 容器中执行 git 命令