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

[PATCH RESEND 0/2] status: improve info for detached HEAD

From
RERoy Eldar <royeldar0@gmail.com>
Date
Mar 8, 2023, 19:20 UTC
Message-ID
<20230308192050.1291-1-royeldar0@gmail.com>

When a repository is cloned using "git clone -b" and a tag is specified, HEAD is automatically detached. As a result, "git status" shows "currently not on any branch", which is not very useful.

Teach "git status" to generate the "HEAD detached at" message in this case as well, in a similar way to when a tag is checked out.

In the case of "git checkout", the name of the ref that was checked out is retrieved from the reflog; for "git clone", the name of the ref isn't present in the reflog entry, so we use the abbreviated hash instead. This is also consistent with the "detached HEAD" advice.

Roy Eldar (2):
  t7508: test status output for detached HEAD after clone
  status: improve info for detached HEAD after clone
 t/t7508-status.sh | 12 ++++++++++++
 wt-status.c       |  7 +++++++
 2 files changed, 19 insertions(+)
-- 
2.30.2
Next: Roy Eldar
Message 1 of 5 in “status: improve info for detached HEAD”
  1. 0/2 status: improve info for detached HEADRoy Eldar, Mar 8, 2023
  2. 1/2 t7508: test status output for detached HEAD after cloneRoy Eldar, Mar 8, 2023
  3. 2/2 status: improve info for detached HEAD after cloneRoy Eldar, Mar 8, 2023
  4. Junio C HamanoMar 8, 2023
  5. Roy EMar 10, 2023

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.