在git的奇怪的远程分支

Pau*_*aul 1 git remote-branch

git branch -a命令为我提供以下输出:

master
stable
remotes/origin/master
remotes/origin/restoring_entered_information_from_post
remotes/origin/stable
Run Code Online (Sandbox Code Playgroud)

但是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'
Run Code Online (Sandbox Code Playgroud)

Mic*_*hař 5

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

git remote prune origin
Run Code Online (Sandbox Code Playgroud)

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

git remote prune -n origin
Run Code Online (Sandbox Code Playgroud)