how can one determine the origin of a git stash

3110 views git

I'm having problems of doing

git stash pop

because of some dos2unix problems. I want to return to working on the stash without having to merge entire files which only differ only by line endings. I was thinking of returning to the stash after doing

git checkout BRANCHNAME

but I don't know how to determine the BRANCHNAME which represents the origin of this stash. Anybody any clue?

answered question

1 Answer


git stash list will probably give you what you want.

If you saved your stash with git stash save or git stash push, then git added a comment to the stash which includes the branch name and the specific commit:

$ git stash list
stash@{0}: WIP on master: 039142b Initial commit

Even if you gave your stash a custom name, git still saves the branch name:

$ git stash save "My stash"
Saved working directory and index state On master: My stash

$ git stash list
stash@{0}: On master: My stash

posted this

Have an answer?


Please login first before posting an answer.