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

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

From
Jeff King <peff@peff.net>
Date
Jul 1, 2013, 21:47 UTC
Message-ID
<20130701214756.GA13962@sigill.intra.peff.net>
In-Reply-To
<7vli5qezqj.fsf@alter.siamese.dyndns.org>
On Mon, Jul 01, 2013 at 02:28:52PM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> 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.

Yeah, I would agree. I do not think this is a new breakage. It behaves the same way all the way back to v1.7.0 (the first commit with t7011). Trying to go back further (by snapshotting the state of the trash directory and just running the reset on it) doesn't work, as older versions do not understand the skip-worktree bit.

I'm not sure yet if it's just a problem with skip-worktree entries, or if you can trigger the problem another way, though.

-Peff
Previous: Junio C Hamano
Message 2 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.