TIL - Named Git Stash
October 3, 2020
You can name a git stash like so:
git stash push -m "message"
Thwn find it like so:
git stash list
And apply the specific stash like so:
git stash apply [email protected]{1}
However git diff may be a better solution
git diff > some.patch
And to apply
git apply some.patch
So I've added these to my shell aliases .
# Store patch
function gdsp() {
git diff > ~/.stashes/$1.patch
gdlp
}
# Apply patch
function gdap() {
git apply ~/.stashes/$1.patch
rm ~/.stashes/$1.patch
gdlp
}
# List patches
function gdlp() {
ls ~/.stashes/
}