【发布时间】:2019-02-26 01:00:07
【问题描述】:
在名为 Repo 的 Git 存储库中有 4 个子模块:
git config --file .gitmodules --name-only --get-regexp path
submodule.A/lib1
submodule.A/lib2
submodule.lib3
submodule.lib4
假设lib1 子模块上有一个名为Prototype 的远程分支,它不再需要:
git submodule foreach 'git branch -a | grep -i prototype || true'
Entering 'path-to-lib1/lib1'
remotes/origin/FeatureA
remotes/origin/Prototype
Entering 'path-to-lib2/lib2'
remotes/origin/FeatureB
Entering 'path-to-lib3/lib3'
Entering 'path-to-lib4/lib4'
remotes/origin/FeatureC
如何从lib1 子模块删除这个Prototype 远程分支?
我尝试了以下方法:
git push origin --delete Prototype
或
git push origin --delete origin/Prototype
或
git push origin --delete remotes/origin/Prototype
以上所有 3 个命令都给出了错误:
error: unable to delete 'Prototype': remote ref does not exist
error: failed to push some refs to 'repo-path'
(我正在尝试理解子模块的主题,但我偶然发现了这个问题,通过一些在线搜索我无法找到答案。)
任何带有解释的命令/建议将不胜感激。
【问题讨论】:
标签: git git-branch git-submodules