📦 Which Stash Had That Code?
Forgot what’s in stash @{3}? git stash show reveals changes. Preview before applying.
📝 Basic Show
# Show latest stash (summary)
git stash show
# Show latest stash (full diff)
git stash show -p
# Show specific stash
git stash show stash@{2}
git stash show -p stash@{2}
# Show files changed (stat)
git stash show --stat
# Show only names of changed files
git stash show --name-only
# Show as patch (email format)
git stash show --patch
🎯 Advanced Inspection
# View stash as commit
git log stash@{0} -1
# Compare stash with current working directory
git diff stash@{0}
# Apply stash but keep it (preview changes in working dir)
git stash apply --index
# List all stashes with their messages
git stash list --format='%gd: %gs'
# Create branch from stash (if you forgot which branch it was from)
git stash branch new-branch stash@{0}
💡 Pro Tips
- Always stash with message: git stash push -m “WIP: login fix”
- git stash list shows messages
- git stash show -p | grep “^+” to see only additions
- Combine with git diff to compare stashes
“Had 5 stashes, forgot what each was. git stash show stash@{2} showed it was the database migration. Applied the right one. stash show saves mistakes.”
