为什么我不能用git push origin删除远程git分支:branchname? [英] Why can't I delete a remote git branch with git push origin :branchname?

查看:672
本文介绍了为什么我不能用git push origin删除远程git分支:branchname?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 git push origin:branchname 推送到远程git分支以删除它时,我收到以下错误消息:

When I try to push to a remote git branch to delete it with git push origin :branchname I get the following error message:


错误:无法推送到不合格的目的地:远程/原产地/ branchname
目的地refspec既不匹配远程的现有参考也不以
开头我们无法根据源代码猜测前缀。

error: unable to push to unqualified destination: remotes/origin/branchname 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.

但是当我键入 git branch -a 我仍然可以在 remotes / origin / branchname 中看到它。为什么我不能远程删除它?

But when I type git branch -a I still see it in remotes/origin/branchname. Why can't I delete it remotely?

推荐答案

该分支已经在源存储库中被删除。您可以在执行 git fetch --all --prune 时将其反映到您的本地遥控器中,这会将其从遥控器中删除。您还可以更具体地执行 git remote prune 来修剪您的遥控器而不更新。

The branch has already been deleted in the origin repository. You can reflect this in your local remotes when you fetch by doing git fetch --all --prune, which will delete it from your remotes. You can also more specifically do git remote prune to just prune your remotes without updating.

这篇关于为什么我不能用git push origin删除远程git分支:branchname?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆