1

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

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

但是restoring_entered_information_from_post在 Github 上没有这样的分支,我从来没有在本地创建它,并且尝试用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'
4

1 回答 1

5

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

git remote prune origin

你可能想先在空运行模式下运行它,看看它会删除什么:

git remote prune -n origin
于 2012-11-30T13:34:10.377 回答