git logo

How to list your git stashes?

Reading Time: 2 minutes.

Long story short, yes, I really had to google this, and since top results seemed to give pretty obtuse answers, I decided to document it for myself.

And just to state the obvious: I’m using GitHub Desktop for most of my mandatory Git stuff, but for 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?

  1. Open any console application that has git executable configured

    Windows PowerShell is my choice, but you can just use Git Bash instead.

  2. Change the working directory to your project’s root folder

    Something along the lines of:

    cd C:\whatever

  3. Run git stash list

    That’ll list your stashes on different repositories and branches.

    The output will look somewhat like this:

    git stash list command output example

  4. Investigate the output

    The screenshot displays different stashes on different branches.

    The branch names for your different stashes are highlighted in this picture.

    (Sorry – I actually took the screenshot from production, so I had to blur the branch names.)

  5. Dig deeper into your stashes

    If you want to quickly see what do the stashes actually contain, there’s another command you can do to find it out:

    git stash show

    This’ll show the contents of the latest stash.Git stash show output

    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. :)

mm
0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments