Subject: Re: How can I remove a remote branch from local repo that is removed at the server side

From: Johannes Sixt <[email-masked]>
Date: Tue, 12 May 2009 09:32:15 +0200

Yakup Akbay schrieb:
> Hi,
> 
> consider the following situation:
> 
>    adg@adghp:~/myrepo$ git branch -a
>    * master
>      origin/HEAD
>      origin/master
>      origin/work
> 
> I want to remove origin/work from my local repository which is no more
> existing at the origin. git fetch (or pull) does not help either.
> However, it disappears when I remove the following line in
> .git/packed-refs file:
> 
>    021a032317425b136b5430c7dead94328996b9d0 refs/remotes/origin/work
> 
> Is there command line version to do it?

Two options:

  git branch -D -r origin/work
  git remote prune origin

The second removes *all* of origin's tracking branches that are not in the
remote anymore. Use it only if you are sure you want that to happen.

-- Hannes