无法从 git 子模块推送提交?
我有一个简单的项目,有一个子模块。
$ 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 [email protected]: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
我不明白为什么它说“一切都是最新的”,因为 964737 提交尚未推送到 github。我可能做错了什么,但我不知道那会是什么..
如何将此子模块中的最新提交推送到 github?
I have a simple project that has one submodule.
$ git submodule
964737623a362f6303e87ec41f2c7090c8c2c093 lib/mongodb-php-odm (heads/master-1-g9647376)
I have made changes to that submodule and committed them, but cannot push them to github.
$ cd lib/mongodb-php-odm
$ git branch
* (no branch)
master
$ git remote -v
origin [email protected]: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
I don't understand why it says "Everything up-to-date" because the 964737 commit has not been pushed to github. It is likely I did something wrong, but I have no idea what that would be..
How do I push the latest commit in this submodule to github?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来您没有提交任何分支,即您的提交不属于任何分支。在您所在的位置创建一个分支,然后启动 gitk 与 master 进行比较,然后根据需要进行挑选或重新设置。
It seems that you committed to no branch, i.e. your commit isn't part of any branch. Create a branch where you're standing, then launch gitk to compare to master, then cherry-pick or rebase as necessary.
我会在这里做的。
正如谢弗所说,你正在进行“无头”提交。正如 ColinM 所说,您可以将该提交合并回 master,如下所示:
编辑:使用
HEAD@{1}
而不是临时分支或标记更简单,因为没有需要清理。表达式HEAD@{1}
表示 HEAD 的先前值,在本例中将是无头分支上的新提交。I'll do that here.
As Scheffer said, you're on a "HEAD-less" commit. As ColinM said, you can merge that commit back to master like this:
EDIT: Using
HEAD@{1}
instead of a temporary branch or tag is simpler since there is no cleanup required. The expressionHEAD@{1}
means the HEAD's previous value which in this case would be the new commit on the headless branch.