Check if "git stash" stashed anything
git stash list #get a listing of all stashes to parse
git stash show -p stash@{0} #replace 0 with number of relevant stash from list
git stash
allows you to provide a message. You can use a generated token as your message so that you know it won't conflict with other git stash messages.
Then, when you want to check whether or not to pop, simply check if the git stash list
output contains your token. If so, pop the stash.