Undo a git stash

Question

I just did a stash in a project that I haven't commit. Is there a way to go back to the state before I stashed? How could I do this? I've closed the terminal and my laptop is shut down. I've done some researched and it seems there's no way to do this.

Answer

You can just run:

git stash pop

and it will unstash your changes.

If you want to preserve the state of files (staged vs. working), use

git stash apply --index

Forking vs. Branching in GitHub

When does Git refresh the list of remote branches?