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

[RFH] "git reset --hard" broken???

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 1, 2013, 21:28 UTC
Message-ID
<7vli5qezqj.fsf@alter.siamese.dyndns.org>
I have no time to dig this down, but I just noticed this by accident:
	$ make
        $ cd t
        $ sh ./t7011-skip-worktree-reading.sh -d
        $ cd trash*.t7011*
        $ git reset --hard HEAD
        error: Entry '1' not uptodate. Cannot merge.
	fatal: Could not reset index file to revision 'HEAD'.

which looks quite bogus. "reset --hard" is meant to be the last resort "no matter what, please match the working tree to the commit" and should not ever error out with "not uptodate Cannot merge" message.

Interestingly, you can do this to work it around, though:
        $ cd t
        $ sh ./t7011-skip-worktree-reading.sh -d
        $ cd trash*.t7011*
	$ git reset
        $ git reset --hard HEAD
        HEAD is now at .... init
Next: Jeff King
Message 1 of 2 in “[RFH] "git reset --hard" broken???”
  1. Junio C HamanoJul 1, 2013
  2. Jeff KingJul 1, 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.