How do you Remove an Invalid Remote Branch Reference from Git?

Posted by Casey on Stack Overflow See other posts from Stack Overflow or by Casey
Published on 2009-07-02T02:39:41Z Indexed on 2010/06/08 18:22 UTC
Read the original article Hit count: 271

Filed under:
|
|

In my current repo I have the following output:

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

I want to delete 'remotes/public/master' from the branch list:

$ git branch -d remotes/public/master
error: branch 'remotes/public/master' not found.

Also, the output of 'git remote' is strange, since it does not list 'public':

$ git remote show 
origin

How can I delete 'remotes/public/master' from the branch list?

Update, tried the 'git push' command:

$ git push public :master
fatal: 'public' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

Solution: The accepted answer had the solution at the bottom!

git gc --prune=now

© Stack Overflow or respective owner

Related posts about git

Related posts about branch