git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Sixt <j.sixt@viscovery.net>
Date
May 12, 2009, 07:32 UTC
Message-ID
<4A0925FF.5030307@viscovery.net>
In-Reply-To
<4A091DB3.4070509@ubicom.com>
Yakup Akbay schrieb:
Show 18 quoted lines
> 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
Previous: Björn Steinbrink
Message 3 of 3 in “How can I remove a remote branch from local repo that is removed at the server side”
  1. Yakup AkbayMay 12, 2009
  2. Björn SteinbrinkMay 12, 2009
  3. Johannes SixtMay 12, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.