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

A few questions about git-reset's reflog messages

From
Ori Avtalion <ori@avtalion.name>
Date
Jul 21, 2011, 19:28 UTC
Message-ID
<4E287DDE.8020108@avtalion.name>
Hi,
I noticed an inconsistency with the reset command's reflog messages.
The command:
    g reset <tree-ish>
Prints this reflog message:
    <tree-ish>: updating HEAD

Usually, actual lines from "git reflog" are: 640a027 HEAD@{0}: HEAD~1: updating HEAD 0657539 HEAD@{1}: 0657539: updating HEAD

This feels redundant and not very informative.

Is there any reason to print the tree-ish in the command? The 'raw' sha1 is already recorded in the reflog.

Why does the message not mention 'reset' in the beginning like (most?) other commands?

I dug into builtin/reset.c to try and improve it, and came across a few odd things, that I'd appreciate if someone would clarify:

* There is code to set a "updating ORIG_HEAD" reflog message, but I
can't trigger it. What use-case causes it?
* The part of the reflog message before the colon is composed by
args_to_str() which prints all of the arguments after the opts. This
seems redundant as the only form of 'reset' that updates the reflog is
one with a single '<commit>' argument after the options. What is there
for args_to_str to loop over?

Thanks, Ori

Next: Jeff King
Message 1 of 3 in “A few questions about git-reset's reflog messages”
  1. Ori AvtalionJul 21, 2011
  2. Jeff KingJul 22, 2011
  3. Junio C HamanoJul 22, 2011

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.