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

Re: git stash data loss

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 14, 2012, 23:04 UTC
Message-ID
<7vtxv01a1o.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120821065527.GC3238@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 15 quoted lines
>> > Hrm. The problem is that after creating the stash, we then run "git
>> > reset --hard" to drop the changes that we just stashed. But that is not
>> > always accurate. It will not usually touch untracked files, but it might
>> > if they have D/F conflicts with tracked files. So we need to replace
>> > that "git reset --hard" with some safer command that will notice we are
>> > about to overwrite untracked files. But I am not sure what that command
>> > would be.
>> 
>> Is this something we still want to keep track of?
>
> Yeah, I think it is worth fixing. It's a somewhat rare case, but data
> loss is bad. I was hoping you would respond with "...and here is the
> magical incantation of git commands to make the working directory look
> like we want". I couldn't come up with one. We may need a new option to
> reset or read-tree.

ls-files has an ancient option to show the files "killed"; perhaps that is the closest thing to what you are looking for.

Previous: Jeff KingNext: Aleksandr Priymak
Message 6 of 7 in “git stash data loss”
  1. Aleksandr PryimakJul 27, 2012
  2. Jeff KingJul 27, 2012
  3. Jeff KingJul 27, 2012
  4. Junio C HamanoAug 17, 2012
  5. Jeff KingAug 21, 2012
  6. Junio C HamanoSep 14, 2012
  7. Aleksandr PriymakJul 27, 2012

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.