So here's what happened: I was on a branch 'A' and did a Git stash on that branch. Then I switched to another branch 'B'. I navigated back to Branch 'A' but did not do a Git stash pop. I switched to the master branch and then back to branch 'A'. I am trying to go a git stash pop now but cant seem to get my changes back.. I need to recover that code but whenever I do a git stash pop, my file changes are not listed. I did not commit any code.
Is there a way to recover the changes that I made? would really appreciate any help in this regards.
Stashes should be viewable via
git stash list
or
gitk --all
also, git stash
does not stash untracked files. If you did this and subsequently did a git checkout --force
of another branch to overwrite untracked files with tracked ones in another branch, you have lost that content. The recommended way to stash is with
git stash -u
This will prevent losses of this type.