git stash list example |Video upload date:  · Duration: PT8M6S  · Language: EN

Quick guide to using git stash list to view inspect and manage saved changes with practical commands and examples

Welcome to the fine art of stash maintenance where you pretend you were working on a feature and not debugging the build for three hours. git stash list is your inventory command when half finished work needs to be parked and you need to look sane to your future self.

Quick stash inventory

Run git stash list to see what you have saved. The output gives a numbered stack that looks like a bulletin board for abandoned ideas. Example output might look like this

stash@{0} - WIP on main 9b3f2c Fix layout glitch
stash@{1} - WIP on feature/auth work in progress
stash@{2} - WIP on experiment quick test

Each entry is an index you can reference, like stash@{0} or stash@{1}. Naming stashes with a message makes life less cryptic and helps you avoid applying the wrong pile of code at the worst possible moment.

Inspect a stash before you touch it

If you do not want surprises run git stash show -p stash@{0} to view the full patch. That shows the exact hunks that were saved so you can decide if you want everything or only a part.

If you only need a quick summary use git stash show stash@{0} which gives a one line diffstat style summary. Use the full patch when you plan to cherry pick hunks or worry about conflicts.

Apply or pop depending on how reckless you feel

Use these commands based on how tidy you want your stash list to remain

  • git stash apply stash@{1} reapplies changes and keeps the stash in the list for later
  • git stash pop reapplies the top stash and removes it from the list in one move

Pop is convenient and slightly reckless if your working tree or index has changes that can conflict. When in doubt apply into a temporary branch and inspect the result.

Name and manage stashes for sanity

Create a human readable stash message with a command like

git stash push -m 'WIP feature X'

Named stashes keep git stash list from reading like a crime scene log. When you finish with a stash remove it with

git stash drop stash@{0}

And if you want dramatic cleanup use

git stash clear

But remember clear deletes everything and there is no undo. This is not optional drama, this is permanent deletion of code you might need.

Simple recovery workflow

  • Inspect the stash with git stash show -p
  • If unsure create a temp branch with git checkout -b temp-restore
  • Reapply the stash with git stash apply stash@{0} and test
  • Once happy drop the stash with git stash drop stash@{0}

Practical tips that save time and dignity

  • Use descriptive messages when you stash to speed up future brain recovery
  • Prefer git stash apply if you want to keep a backup copy of the stash
  • Use git stash pop when you are sure and you do not mind cleaning up right away
  • When resolving conflicts on apply do it on a branch to avoid contaminating main work
  • Keep your stash list tidy so it does not become a graveyard of abandoned experiments

Stashing is not magic, it is a polite lie you tell your repo while you go fix something else. Use git stash list to keep track, inspect changes with git stash show -p, and restore carefully with git stash apply or git stash pop. Follow these steps and you will avoid the horror of restoring the wrong patch and wondering why the app broke in spectacular fashion.

I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!

This is a dedicated watch page for a single video.