gpt4 book ai didi

git - 如何删除子模块的远程分支 (Git)

转载 作者:太空狗 更新时间:2023-10-29 14:41:46 25 4
gpt4 key购买 nike

在名为 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 push --delete origin Prototype

关于git - 如何删除子模块的远程分支 (Git),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52446745/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com