#SharePointProblems | Koskila.net

Solutions are worthless unless shared! Antti K. Koskela's Personal Professional Blog
>

How to list your git stashes

koskila
Reading Time 2 min
Word Count 297 words
Comments 0 comments
Rating 4 (1 votes)
View

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?

  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:\projects\myproject

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

Comments

Interactive comments not implemented yet. Showing legacy comments migrated from WordPress.

No comments yet.