0

I just recently cloned a repo and made changes to it. I pulled the latest commits from a branch called dev but before that I stashed my changes with a message using this command:

git stash save "mymessage"

giving me a message after that saying:

C:\Program Files (x86)\Git/libexec/git-core\git-stash: line 186: c:/Users/Mine/source/repos/My Branch/ .git/logs/refs/stash: No such file or directory Saved working directory and index state On dev: mymessage HEAD is now at 1413c2 Latest Commit.

then used

git pull

just that. The pull was fine. My local repo was now updated but then when I tried to apply my stash. No list was found when I checked. Even after using

git stash list

nothing appears but another command line. When I to try use

git stash apply

it gives me a message saying:

ref/stash@{0} is not a valid reference

I've done this a couple times before from a another local repo and it's doing fine. This is the first time I've encountered this from a new local repo.

germikee
  • 101
  • 10
  • What's your question now? – Basilevs May 18 '15 at 02:06
  • how can I find my stash and apply it? @Basilevs – germikee May 18 '15 at 02:07
  • 4
    It's gone. The original stash never happened, as per your earlier message. – mprat May 18 '15 at 02:09
  • You can also try `git stash pop`. If that also results in nothing happening, then you rest assured that you have no stashes available. – Tim Biegeleisen May 18 '15 at 02:10
  • Oh nooo! but I was able to pull the latest commits. What happened then to the changes I made? :( @mprat – germikee May 18 '15 at 02:12
  • Related: http://stackoverflow.com/questions/18480174/git-stash-fails-error-unable-to-resolve-reference-refs-stash-no-such-file-or – Basilevs May 18 '15 at 02:13
  • 1
    @germikee Pulling and stashing aren't related - the links in the answer below might have some insight about dropped stashes. In general, best practice is to commit the changes to another branch before pulling so you don't lose changes. – mprat May 18 '15 at 02:20
  • Damn.... is that so. Bummer! thanks for the replies @mprat – germikee May 18 '15 at 02:26

1 Answers1

2

You won't find your stash, because you don't have any. Git failed to create one for you, and properly reported the problem, but you've opted to ignore this.

Try to look in git reflog - a commit created for stashing might still be there. How to recover a dropped stash in Git?

Community
  • 1
  • 1
Basilevs
  • 22,440
  • 15
  • 57
  • 102