我有以下项目结构:
root-project
|
|-- A
| |
| |-- C
|
|-- B
A 和 B 是根项目的子模块。 C 又是一个子模块
假设我对项目 A、B 和 C 进行了更改,并且
将这些变化提交给各自的指数。之后我更新
根项目中对 A 和 B 的引用并提交该更改
以及。当我使用选项推送根项目的更改时
--recurse-submodules=on-demand, git 推送项目 A 的所有提交,
B 和根项目,但默默地忽略了
项目C。我希望它也能推动项目C的变化。
我知道我可以通过在根项目文件夹中使用以下两个命令来解决这个问题。
git submodule foreach --recursive 'git push origin master'
git push
有人可以澄清我是否做错了什么,或者这是否是 git-push 中的错误。我已经在 git 邮件列表上提出了这个问题,但没有收到任何回复:http://thread.gmane.org/gmane.comp.version-control.git/266184 http://thread.gmane.org/gmane.comp.version-control.git/266184
我还编写了一个小 shell 脚本,用于设置所描述的项目结构并执行递归推送操作:https://gist.github.com/usommerl/6e8defcba94bd4ba1438 https://gist.github.com/usommerl/6e8defcba94bd4ba1438
git版本2.3.3
git push --recurse-submodules=on-demand
将与 git 2.14.x/2.15(2017 年第 3 季度)真正递归,但有一些条件。
See commit c7be720 https://github.com/git/git/commit/c7be7201a7b71f590325f0d858f909a4c0b443f6 (20 Jul 2017) by Brandon Williams (mbrandonw) https://github.com/mbrandonw.
(Merged by Junio C Hamano -- gitster -- https://github.com/gitster in commit a49794d https://github.com/git/git/commit/a49794d10826ef7cc9237abcf6474cd826de1063, 22 Aug 2017)
子模块--helper:教push-check处理HEAD
In 06bf4ad https://github.com/git/git/commit/06bf4ad1db92c32af38e16d9b7f928edbd647780 (push
:传播远程和 refspec
--recurse-submodules, git 2.13.0) 当 '--recurse-submodules
' 给出了标志。
The 只有允许传播的引用规范是命名超级项目和子模块中都存在的引用的引用规范,但需要注意的是“HEAD”是不允许的。
这个补丁教授push-check(子模块助手,它确定是否
refspec 可以传播到子模块)以允许传播 'HEAD
'
当且仅当:
- 超级项目和子模块都有相同的
已检出指定分支并
- 子模块不处于分离头状态。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)