Bash

Stash With a Message

admin by @admin ADMIN
5d ago
May 31, 2026
Public
0 0 up · 0 down Sign in to vote
`git stash` without args is hard to grep through later. Always pass a message — your future self will thank you.
Bash
Raw
# Save with a message describing WHY
git stash push -m "WIP: fixing the cancel button"

# Stash only specific files
git stash push -m "frontend tweaks" -- src/components/Button.tsx

# Include untracked files (default skips them)
git stash push -u -m "scratch experiment"

# List with messages visible
git stash list
# stash@{0}: On feature-branch: WIP: fixing the cancel button
# stash@{1}: On main: scratch experiment

# Inspect a stash without applying
git stash show -p stash@{1}

# Apply by message (no need to remember the index)
git stash apply "$(git stash list | grep 'fixing the cancel' | awk -F: '{print $1}')"
Tags

Save your own code snippets

Create a free account and build your private vault. Share publicly whenever you want.