I have a small patch saved away in my git stash. I\'ve applied it to my working copy using git stash apply. Now, I\'d like to back out those changes by revers
This is in addition to the above answers but adds search for the git stash based on the message as the stash number can change when new stashes are saved. I have written a couple of bash functions:
apply(){
if [ "$1" ]; then
git stash apply `git stash list | grep -oPm1 "(.*)(?=:.*:.*$1.*)"`
fi
}
remove(){
if [ "$1" ]; then
git stash show -p `git stash list | grep -oPm1 "(.*)(?=:.*:.*$1.*)"` | git apply -R
git status
fi
}
$ git stash save "my stash"$ apply "my stash"$ remove "my stash"