0

I am working with git for a college project and it has been a tricky learning curve. Last night I was trying to upload my work into the main tree and I did first a 'git stash' in terminal and it seems to have reset my code to the previous version. I am a git novice. Is there a way that I can get my work back?

Heres what I put in to terminal and what it read out:

$ git stash
Saved working directory and index state WIP on master: 00b2935 undated with desktop(unfinished)
HEAD is now at 00b2935 undated with desktop(unfinished)
[  ][ darraghkenny ][][master=][ ~/projects/RosettaFoundation-new-design ]
$ 
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
  • git stash pop applies the top stashed element and removes it from the stack. git stash apply does the same, but leaves it in the stash stack – Joel Aug 11 '15 at 13:25

2 Answers2

2

you can type

$ git stash list

to print out a list of all previously saved stashes.

Chronologically, you can fetch them back using

$ git stash apply stash@{0}

being the latest one, stash@{1} being the penultimate one, and stash@{N} for subsequent stashes

ddavison
  • 28,221
  • 15
  • 85
  • 110
  • Thank you sircapsalot. That worked for me and I will research further into the stashing process. Also I will mark your answer correct when it allows. – Daniel Garland Aug 11 '15 at 13:31
  • If there are multiple entries in the stash, you can use `git stash show -p stash@{n}` for a preview of the nth entry without applying its content. – k0pernikus Aug 12 '15 at 00:02
0

Just use this command can do the work:

    git stash pop 
Luis404
  • 196
  • 4