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

Re: Prevent reset --hard from deleting everything if one doesn't have any commits yet

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 3, 2019, 01:38 UTC
Message-ID
<xmqqa7ic3fgn.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190301134759.GA13402@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Wouldn't that mean all of the file data is available in the object
> database? Unfortunately without an index, there's nothing to mark which
> file was which. But `git fsck --lost-found` should copy out all of the
> file content into .git/lost-found.

If we had a hierachically stored index that stores subdirectory contents as a tree (or some tree-like things), "fsck --lost-found" would have been able to recover even pathnames, but with the current flat index in a fresh directory without any commit, we'd get bunch of blobs without any clue as to where each of them goes. It would be far better than nothing, but leaves room for improvement.

Previous: Jeff King
Message 5 of 5 in “Prevent reset --hard from deleting everything if one doesn't have any commits yet”
  1. Manuel GuilamoFeb 28, 2019
  2. Johannes SixtMar 1, 2019
  3. Manuel GuilamoMar 1, 2019
  4. Jeff KingMar 1, 2019
  5. Junio C HamanoMar 3, 2019

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.