Resourcesโ€บGit Tricksโ€บGit Stash Tricks You Probably Don't Know
๐Ÿ”€Git Tricksโ€” Git Stash Tricks You Probably Don't Knowโฑ 5 min

Git Stash Tricks You Probably Don't Know

Git stash is more powerful than just 'save and restore.' Here are the tricks that make it actually useful.

๐Ÿ“…January 23, 2026โœTechTwitter.iogitstashworkflowtricks

Beyond git stash and git stash pop

Most developers use git stash as a panic button: changes aren't ready, need to switch branches, so stash and restore. That's useful, but stash has a lot of power most people never use.


Name Your Stashes

# Basic (bad) โ€” stash has no context
git stash

# Better โ€” give it a name
git stash push -m "WIP: user auth refactor, blocked on API question"

List them:

$ git stash list
stash@{0}: On main: WIP: user auth refactor, blocked on API question
stash@{1}: On feature/payments: temp: disable rate limiting for testing
stash@{2}: WIP on main: 3b892c1 fix: add retry logic

Much more useful than three unnamed WIP stashes.


Stash Only Specific Files

# Stash everything except specific files
git stash push -- src/api.ts src/models.ts

# Stash including untracked files
git stash push -u

# Stash including untracked AND ignored files
git stash push -a

The -- separator tells git what files to stash. Without it, everything gets stashed.


Stash Only Staged Changes

# Stage some changes
git add src/feature.ts

# Stash only the staged changes (keep unstaged working tree)
git stash push --staged

This lets you "park" work-in-progress while keeping a clean, partially-done state in your working tree.


Apply Without Popping

# Pop: apply stash AND remove from stash list
git stash pop

# Apply: apply stash but KEEP it in the stash list
git stash apply stash@{1}

Use apply instead of pop when you want to apply the stash to multiple branches, or when you're not sure the apply will work cleanly and want to keep the stash as a backup.


Create a Branch from a Stash

This is the most underused stash feature:

git stash branch feature/my-stashed-work stash@{0}

This:

  1. Creates a new branch at the commit where the stash was created
  2. Applies the stash to that branch
  3. Drops the stash if the apply was clean

Perfect for when you realize "this change I stashed is actually a proper feature."


Show What's in a Stash

# See a summary of what's in a stash
git stash show stash@{0}

# See the full diff
git stash show -p stash@{0}

Clean Up Old Stashes

# Drop a specific stash
git stash drop stash@{2}

# Clear ALL stashes (careful โ€” no recovery)
git stash clear

Old stashes accumulate. Add a monthly reminder to run git stash list and drop ones you don't need.


Stash and Pull Pattern

Common workflow: you're mid-work when someone asks you to pull the latest changes:

git stash push -m "WIP: current task"
git pull --rebase
git stash pop

If there are conflicts between your stash and the new pulls, git will flag them. Resolve like normal merge conflicts.


Key Takeaways

  • Always name stashes with -m โ€” you'll thank yourself later
  • stash apply instead of stash pop when you want to keep the stash
  • stash push -- file.ts to stash only specific files
  • stash branch to promote a stash into a proper branch
  • stash show -p to see exactly what's saved before applying