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.