{"thread":{"id":"16753","subject":"Undo a git stash clear","startedAt":"2008-12-16T12:07:28Z","lastAt":"2008-12-16T12:20:39Z","messageCount":5,"participants":["Alexander Gladysh","Johannes Schindelin","Jeff King","Jonathan del Strother","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"98066","messageId":"c6c947f60812160407l1b2593e1pde817f5cfb091d59@mail.gmail.com","threadId":"16753","inReplyTo":null,"subject":"Undo a git stash clear","fromName":"Alexander Gladysh","fromEmail":"agladysh@gmail.com","sentAt":"2008-12-16T12:07:28Z","receivedAt":"2008-12-16T12:07:28Z","isPatch":false,"sender":{"key":"agladysh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/38239?v=4"},"body":"Hi, list!\n\nI've stashed some valuable changes and then I accidentally did git\nstash clear. (Yes, today is not my day).\n\nIs it possible to restore stashed changes?\n\nAlexander.\n"},{"id":"98067","messageId":"alpine.DEB.1.00.0812161309370.14632@racer","threadId":"16753","inReplyTo":"c6c947f60812160407l1b2593e1pde817f5cfb091d59@mail.gmail.com","subject":"Re: Undo a git stash clear","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-12-16T12:10:06Z","receivedAt":"2008-12-16T12:10:06Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 16 Dec 2008, Alexander Gladysh wrote:\n\n> I've stashed some valuable changes and then I accidentally did git stash \n> clear. (Yes, today is not my day).\n> \n> Is it possible to restore stashed changes?\n\nYou might find them with \"git fsck --lost-found\".\n\nHth,\nDscho\n"},{"id":"98068","messageId":"20081216121245.GA8432@coredump.intra.peff.net","threadId":"16753","inReplyTo":"c6c947f60812160407l1b2593e1pde817f5cfb091d59@mail.gmail.com","subject":"Re: Undo a git stash clear","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-12-16T12:12:49Z","receivedAt":"2008-12-16T12:12:49Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Dec 16, 2008 at 03:07:28PM +0300, Alexander Gladysh wrote:\n\n> I've stashed some valuable changes and then I accidentally did git\n> stash clear. (Yes, today is not my day).\n> \n> Is it possible to restore stashed changes?\n\nTry git-fsck; it should report some dangling commits (i.e., commits that\nare in the object db but aren't reachable by any refs). Then you can\neither pull the changes out directly (try git cherry-pick -m1 $sha1) or you\ncan even restore it as a stash (git update-ref -m oops refs/stash\n$sha1).\n\n-Peff\n"},{"id":"98069","messageId":"57518fd10812160412j1edc2ea0mff732825f1f6c4a2@mail.gmail.com","threadId":"16753","inReplyTo":"c6c947f60812160407l1b2593e1pde817f5cfb091d59@mail.gmail.com","subject":"Re: Undo a git stash clear","fromName":"Jonathan del Strother","fromEmail":"maillist@steelskies.com","sentAt":"2008-12-16T12:12:52Z","receivedAt":"2008-12-16T12:12:52Z","isPatch":false,"sender":{"key":"jon.delstrother@bestbefore.tv","avatar":"https://gravatar.com/avatar/754e21ab701c00e2d21fc261187254c34b2a1c0b959d9ee5be1a295990be3081?d=mp&s=160"},"body":"On Tue, Dec 16, 2008 at 12:07 PM, Alexander Gladysh <agladysh@gmail.com> wrote:\n> Hi, list!\n>\n> I've stashed some valuable changes and then I accidentally did git\n> stash clear. (Yes, today is not my day).\n>\n> Is it possible to restore stashed changes?\n\nI ran into this exact problem on Friday.  Some helpful person on IRC\nsuggested using\n\ngit fsck | grep commit | cut -d' ' -f3 | while read hash; do git\nrev-parse --verify --quiet $hash^2 && echo $hash; done | xargs git\nshow\n\nWhich will show a huge list of lost changes.  Once you find the change\nyou're interested in, you can cherry-pick its sha1.\n"},{"id":"98070","messageId":"vpq1vw81fc8.fsf@bauges.imag.fr","threadId":"16753","inReplyTo":"57518fd10812160412j1edc2ea0mff732825f1f6c4a2@mail.gmail.com","subject":"Re: Undo a git stash clear","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2008-12-16T12:20:39Z","receivedAt":"2008-12-16T12:20:39Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\"Jonathan del Strother\" <maillist@steelskies.com> writes:\n\n> On Tue, Dec 16, 2008 at 12:07 PM, Alexander Gladysh <agladysh@gmail.com> wrote:\n>> Hi, list!\n>>\n>> I've stashed some valuable changes and then I accidentally did git\n>> stash clear. (Yes, today is not my day).\n>>\n>> Is it possible to restore stashed changes?\n>\n> I ran into this exact problem on Friday.  Some helpful person on IRC\n> suggested using\n\n(and the obvious advice before anything else : don't \"git gc\", don't\n\"git prune\", and if possible back-up the repository before anything\nelse)\n\n-- \nMatthieu\n"}]}