【发布时间】:2016-12-13 14:38:24
【问题描述】:
我使用的是 git 版本 2.7.4,带有子模块。我的项目结构是这样的:
main/
file1
file2
subm1/
file3
file4
subm2/
file5
根据this question 我想推入子模块。例如,在file3中更改后,我正在使用这个命令来推送它:
cd subm1/
git add file3
git commit -m 'Update file3'
git push origin master
我收到了这个错误:
Pushing submodule 'subm1'
To <submodule git repo>
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to <submodule git repo>
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Unable to push submodule 'subm1'
fatal: Failed to push all needed submodules!
但是当我像这样使用拉时收到Already up-to-date:
subm1$ git pull origin master
From https://gitlab.com/systemnegar-ai/compare
* branch master -> FETCH_HEAD
Already up-to-date.
如何将其推送到子模块源存储库中?
【问题讨论】:
标签: git git-submodules git-push