Daniel Weston
Daniel Weston

Reputation: 3

Why does git stash pop acts as apply

Anybody know why the drop part of the pop would not work for me? pop is behaving like apply.

My process is:

git stash save "name of save"
git stash pop

then:

git stash list (and "name of save" will still be listed). 

enter image description here

Upvotes: 0

Views: 46

Answers (1)

axiac
axiac

Reputation: 72376

This usually happens when the changes stored in the stash cannot be applied clean and they leave the working tree in a conflicting state. git stash pop reports this in its output. You can also find if this is the case by running git status.

The reason behind this behaviour is very simple: you can run git reset --hard and git stash pop never happened. If you tried to pop the stash in the wrong context (wrong checked out branch) this way you can easily checkout the correct commit and try git stash pop again in the correct context.

Upvotes: 2

Related Questions