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?
Alexander.
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?
Alexander.
Re: Undo a git stash clear
Hi,
On Tue, 16 Dec 2008, 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?
You might find them with "git fsck --lost-found".
Hth, Dscho
Re: Undo a git stash clear
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
Re: Undo a git stash clear
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.
Re: Undo a git stash clear
"Jonathan del Strother" <maillist@steelskies.com> writes:
> 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
(and the obvious advice before anything else : don't "git gc", don't "git prune", and if possible back-up the repository before anything else)
-- Matthieu