Apply stash only if able to successfully stash a change.

Apply the top of the stash stack only if the pre-commit and pre-push
hooks were able to successfully stash a change at the beginning on the
script's execution. This will prevent accidentally un-stashing a change
that was not stashed by the script.