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

Re: deleting a branch

From
Junio C Hamano <junkio@cox.net>
Date
Sep 13, 2005, 16:05 UTC
Message-ID
<7v4q8p3qd8.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<4326F2AE.50108@citi.umich.edu>
Chuck Lever <cel@citi.umich.edu> writes:
> a couple of newbie questions.
>
> 1.  how do i delete a branch?

"rm -f .git/refs/heads/no-longer-needed". Make sure your working tree is not on that branch (i.e. .git/HEAD should not be pointing at it).

I have not introduced "git branch -d no-longer-needed" because I think that should do a bit more than "rm -f". For example:

 - making sure you are not on that branch (obvious),
 - check if all changes on that branch are included in the
   master branch or some other branch (easy if we hardcode "master";
   checking all other branches might be nicer but expensive).
 - otherwise tell the user this and that changes will be forever
   lost and get a confirmation before removing.
> 2.  is there a conventional place where branch description files reside?
No, but somebody proposed a convention a couple of days ago.
Previous: Chuck LeverNext: Daniel Barkalow
Message 2 of 6 in “deleting a branch”
  1. Chuck LeverSep 13, 2005
  2. Junio C HamanoSep 13, 2005
  3. Daniel BarkalowSep 13, 2005
  4. git-branch -d <branch>: delete unused branch.Junio C Hamano, Sep 14, 2005
  5. Chuck LeverSep 14, 2005
  6. Junio C HamanoSep 14, 2005

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.