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

Re: [RFC] Delete current branch

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Jul 19, 2013, 14:35 UTC
Message-ID
<CALkWK0kGF+d8Jk-TVfb6iwk6LuOcD-Uuuj6DHf-4YeVAFLSvuw@mail.gmail.com>
In-Reply-To
<87y592y67f.fsf@igel.home>
Andreas Schwab wrote:
Show 6 quoted lines
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>
>>   # er, what was the branch name again?
>>   $ git checkout -
>
> You could take a look in the reflog.

Yeah, or use the @{-N} revision to do that for me. My scripted version is essentially:

  test "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" || exit 1
  git checkout master
  git branch -D @{-1}

The main problem is the hard-coding of "master": I suppose I could replace that with @{-1} too.

Not a big deal: I was just wondering if others use it often enough for it to become `branch -Dc` in core; @{-N} is quite obscure.

Previous: Andreas SchwabNext: Junio C Hamano
Message 3 of 10 in “[RFC] Delete current branch”
  1. Ramkumar RamachandraJul 19, 2013
  2. Andreas SchwabJul 19, 2013
  3. Ramkumar RamachandraJul 19, 2013
  4. Junio C HamanoJul 19, 2013
  5. Ramkumar RamachandraJul 19, 2013
  6. Junio C HamanoJul 19, 2013
  7. Ramkumar RamachandraJul 19, 2013
  8. Taylor HedbergJul 19, 2013
  9. Junio C HamanoJul 19, 2013
  10. Junio C HamanoJul 19, 2013

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.