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

Re: Bug in git branch --show-current

From
KHKristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Date
May 27, 2025, 07:24 UTC
Message-ID
<24a091bf-daef-4c97-b233-1a0f5c329f25@app.fastmail.com>
In-Reply-To
<FR0P281MB28795FB4A108A6044273B39C9464A@FR0P281MB2879.DEUP281.PROD.OUTLOOK.COM>
On Tue, May 27, 2025, at 09:00, Ulrich Wittenberg wrote:
> What happened instead? (Actual behavior)
> The command returns absolutely nothing.
This is the documented behavior for detached HEAD.

It sounds like you want to know what branches point to the commit you are detached at?

    git for-each-ref --format='%(refname:short)' --points-at=HEAD refs/heads/
-- 
Kristoffer Haugsbakk
Previous: Ulrich WittenbergNext: Kristoffer Haugsbakk
Message 2 of 3 in “Bug in git branch --show-current”
  1. Ulrich WittenbergMay 27, 2025
  2. Kristoffer HaugsbakkMay 27, 2025
  3. Kristoffer HaugsbakkMay 27, 2025

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.