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

Re: Undo a git stash clear

From
Jeff King <peff@peff.net>
Date
Dec 16, 2008, 12:12 UTC
Message-ID
<20081216121245.GA8432@coredump.intra.peff.net>
In-Reply-To
<c6c947f60812160407l1b2593e1pde817f5cfb091d59@mail.gmail.com>
On Tue, Dec 16, 2008 at 03:07:28PM +0300, Alexander Gladysh wrote:
> I've stashed some valuable changes and then I accidentally did git
> stash clear. (Yes, today is not my day).
> 
> Is it possible to restore stashed changes?

Try git-fsck; it should report some dangling commits (i.e., commits that are in the object db but aren't reachable by any refs). Then you can either pull the changes out directly (try git cherry-pick -m1 $sha1) or you can even restore it as a stash (git update-ref -m oops refs/stash $sha1).

-Peff
Previous: Johannes SchindelinNext: Jonathan del Strother
Message 3 of 5 in “Undo a git stash clear”
  1. Alexander GladyshDec 16, 2008
  2. Johannes SchindelinDec 16, 2008
  3. Jeff KingDec 16, 2008
  4. Jonathan del StrotherDec 16, 2008
  5. Matthieu MoyDec 16, 2008

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.