在git的奇怪的远程分支

时间:2012-11-30 13:28:10

标签: git remote-branch

git branch -a命令给出了以下输出:

master
stable
remotes/origin/master
remotes/origin/restoring_entered_information_from_post
remotes/origin/stable

但是在Github上没有这样的分支restoring_entered_information_from_post,我从未在本地创建它,并且在试图用git push origin :restoring_entered_information_from_post删除它时它会响应:

error: unable to push to unqualified destination: restoring_entered_information_from_post
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:MyCompany/mywebsite.git'

1 个答案:

答案 0 :(得分:5)

分支很可能在过去确实存在并且在Github上被删除了。默认情况下,Git不会删除这些陈旧的分支。要删除不存在的远程分支,可以使用:

git remote prune origin

您可能希望首先在干运行模式下运行它以查看它将删除的内容:

git remote prune -n origin