This post was most recently updated on August 26th, 2022.
2 min read.Long story short, yes, I really did have to google this, and since top results seemed to give pretty unclear (or even wrong) answers, I decided to document it for myself. Maybe it’ll be helpful to someone else too!
And just to state the obvious: I’m using GitHub Desktop for most of my mandatory Git stuff, but whenever I have to run any git commands, I run Windows PowerShell (git exe is added to PATH variable).
Solution
Well, it’s actually very, VERY simple. You can just run something like this:
git stash list
The command outputs a nice list of all stashes you have and which branch they belong to. But what to make of it?
Time needed: 10 minutes
How to list your Git stashes using PowerShell?
- Open any console application that has git executable configured
Windows PowerShell is my choice, but you can just use Git Bash instead.
- Change the working directory to your project’s root folder
Something along the lines of:
cd C:\projects\myproject
- Run git stash list
That’ll list your stashes on different repositories and branches.
The output will look somewhat like this: - Investigate the output
The screenshot displays different stashes on different branches.
(Sorry – I actually took the screenshot from production, so I had to blur the branch names.) - Dig deeper into your stashes
If you want to quickly see what the stashes actually contain, there’s another command you can do to find it out:
git stash show
This will show the contents of the latest stash.
If you want to investigate stashes other than the latest, you can just add the id of the stash as an additional parameter:git stash show 1
Now that you’ve got a list of your stashes and branches, you should know where to go! :)
- Taming my Home Assistant database growth - February 11, 2025
- Dev Drive performance increase in real life scenarios? - February 4, 2025
- Join my session at CTTT25 this week: Level Up Your Teams Extensibility Game with Blazor | Session materials from Cloud Technology Townhall Tallinn 2025! - January 28, 2025