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

Re: Undo a git stash clear

From
Jonathan del Strother <maillist@steelskies.com>
Date
Dec 16, 2008, 12:12 UTC
Message-ID
<57518fd10812160412j1edc2ea0mff732825f1f6c4a2@mail.gmail.com>
In-Reply-To
<c6c947f60812160407l1b2593e1pde817f5cfb091d59@mail.gmail.com>
On Tue, Dec 16, 2008 at 12:07 PM, Alexander Gladysh <agladysh@gmail.com> wrote:
Show 6 quoted lines
> Hi, list!
>
> 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?

I ran into this exact problem on Friday. Some helpful person on IRC suggested using

git fsck | grep commit | cut -d' ' -f3 | while read hash; do git rev-parse --verify --quiet $hash^2 && echo $hash; done | xargs git show

Which will show a huge list of lost changes. Once you find the change you're interested in, you can cherry-pick its sha1.

Previous: Jeff KingNext: Matthieu Moy
Message 4 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.