3

So I stashed some changes with

git stash

I then executed a

git stash drop

And then I ran

git stash clear

I wanted to restore my changes, I think I just lost my changes, is this true?

Brian Ogden
  • 18,439
  • 10
  • 97
  • 176
  • See http://stackoverflow.com/questions/89332/recover-dropped-stash-in-git – Richard Fearn Jun 16 '15 at 00:46
  • Thanks this somewhat helps though I am on a Windows machine and it looks like the cmds to see all the commits at the tips of the commit graph which are no longer referenced are Linux cmds in part because of the awk, and I do not know how to parse out gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' ) I think the dollar sign might also be Linux specific – Brian Ogden Jun 16 '15 at 00:59
  • @BrianOgden: If you don't have some way of running those specific commands, then just `git reflog` is your friend. You'll be able to find your stashed files in there somewhere. Or, you can use individual commands like `git fsck --no-reflog`, get the output of that, and manually search for "dangling commit". All those commands in the linked answers are just doing some of the busy work for you. – Greg Hewgill Jun 16 '15 at 01:32
  • Fair enough, but the think about this being a duplicate question, the question you referenced, they user run git stash pop, but I ran git stash drop and git stash clear, do you think I still have a reference of some kind to this commit? – Brian Ogden Jun 16 '15 at 01:56
  • Yes, you do have a reference. Git always keeps references around for a while (but don't run `git gc` until you get your code back, because that will discard old references). – Greg Hewgill Jun 16 '15 at 02:43
  • Ok well I am having trouble managing all the dangling commits that are being returned by git fsck --no-reflog, there is no date, no delta and there is more than 50 SHA-1 keys to go through, I have tried passing the list to gitk but that is a failure, see here: http://stackoverflow.com/questions/30857806/erroring-passing-git-fsck-log-to-gitk-in-windows?noredirect=1#comment49759001_30857806 – Brian Ogden Jun 16 '15 at 03:05

0 Answers0