'git branch -av'显示不再存在的远程分支 [英] 'git branch -av' showing remote branch that no longer exists

查看:970
本文介绍了'git branch -av'显示不再存在的远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个愚蠢的问题,但我对git全新,并且看到一个不再存在的远程分支。

This is probably a dumb question, but I'm brand new to git and am seeing a remote branch that no longer exists.

$ git branch -a
* master
  remotes/origin/master
  remotes/origin/production

我不相信生产分支是远程存在的,无法弄清它为什么仍然在本地显示。我如何删除/删除这个分支?下面是试图删除它的样子:

I don't believe the production branch exists remotely and can't figure out why it still shows locally. How can I delete/remove this branch? Here's what an attempt to remove it looks like:

$ git push origin :production

error: unable to push to unqualified destination: production
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@IP:puppet.git'

我可以检出所谓的远程生产分支,但得到这个:

I can checkout the supposedly remote production branch but get this:

$ git checkout origin/production
Note: checking out 'origin/production'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at c323996... added powerdns module, no really

我不知道我在做什么。任何帮助将不胜感激。

I have no clue what the heck I'm doing. Any help would be appreciated.

推荐答案

您必须这样做:

You have to do:

git remote prune origin

这篇关于'git branch -av'显示不再存在的远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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