git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jonathan del Strother" <maillist@steelskies.com>
To: "Alexander Gladysh" <agladysh@gmail.com>
Cc: git@vger.kernel.org, git-users@googlegroups.com
Subject: Re: Undo a git stash clear
Date: Tue, 16 Dec 2008 12:12:52 +0000	[thread overview]
Message-ID: <57518fd10812160412j1edc2ea0mff732825f1f6c4a2@mail.gmail.com> (raw)
In-Reply-To: <c6c947f60812160407l1b2593e1pde817f5cfb091d59@mail.gmail.com>

On Tue, Dec 16, 2008 at 12:07 PM, Alexander Gladysh <agladysh@gmail.com> wrote:
> 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.

  parent reply	other threads:[~2008-12-16 12:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16 12:07 Undo a git stash clear Alexander Gladysh
2008-12-16 12:10 ` Johannes Schindelin
2008-12-16 12:12 ` Jeff King
2008-12-16 12:12 ` Jonathan del Strother [this message]
2008-12-16 12:20   ` Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57518fd10812160412j1edc2ea0mff732825f1f6c4a2@mail.gmail.com \
    --to=maillist@steelskies.com \
    --cc=agladysh@gmail.com \
    --cc=git-users@googlegroups.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).