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

Re: Deletion of remote branches

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 1, 2012, 17:22 UTC
Message-ID
<7v1uhids5a.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CC8F65C7.E79%jens.hausherr@xing.com>
Jens Hausherr <Jens.Hausherr@xing.com> writes:
Show 9 quoted lines
> I came across an issue with deleting remote branches: When deleting a
> branch using "git branch ­r ­d <branch>" the branch is deleted and no
> longer shown by "git branch ­r".
>
> "git ls-remote --heads" on the other hand still lists the ref for the last
> branch commit.
>
> If I delete the branch using "git push origin :<branch>" the branch is
> removed completely (i.e. git ls-remote  no longer returns a ref).

All of the above are expected and working as designed. Remote tracking branches are local _copies_ of what you have over there at the remote repository. The latter is the authoritative version, and you asked "ls-remote" to go over the network to view them.

If you are trying to remove the branches you show to others and yourself who are observing that remote repository from your local workstation, you can first "git push origin :<branch>" to remove it in the remote repository. You can run your next fetch with "--prune" to get rid of remotes/origin/<branch>, I think.

Previous: Jens HausherrNext: Philip Oakley
Message 2 of 5 in “Deletion of remote branches”
  1. Jens HausherrOct 1, 2012
  2. Junio C HamanoOct 1, 2012
  3. Philip OakleyOct 1, 2012
  4. Junio C HamanoOct 1, 2012
  5. Jens HausherrOct 2, 2012

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.