TIL - Named Git Stash

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

# Apply patch
function gdap() {
    git apply ~/.stashes/$1.patch
    rm ~/.stashes/$1.patch

# List patches
function gdlp() {
    ls ~/.stashes/

You'll only receive email when they publish something new.

More from After Gibson