gpt4 book ai didi

git - GitHub如何强制删除远程分支?

转载 作者:IT王子 更新时间:2023-10-29 01:30:04 24 4
gpt4 key购买 nike

我有 2 个远程分支:

 - pending-issues-in-project
- new-issues-in-project

我试过像这样删除pending-issues-in-project:
git push origin :pending-issues-in-project,但我得到了错误:

error: unable to push to unqualified destination: pending-issues-in-project
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'git@github.com:forkedRepo/RepoName.git'

所以我想可能是我删除了 pending-issues-in-project 分支,但是当我运行
git branch -a 它在列表中显示 pending-issues-in-project 分支。
当我为 new-issues-in-project 尝试相同(尝试删除)时,它起作用了。
我已经使用 git branch -D branchName 从本地服务器删除了两个分支。

If the error is coming because the branch not exist in repository then why its coming in remote branch list?
and
Is there any way to forcefully deletion of the remote branch?

感谢您的宝贵时间。

最佳答案

你必须做的:

git remote prune origin

删除本地 git 存储库中的远程跟踪分支( prune 删除远程源中不再存在的任何分支)。之后在git branch -a

下就看不到了

关于git - GitHub如何强制删除远程分支?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8754183/

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