A git stash cheat sheet

A summary of usages of git stash commands:

1. List current stashes

> git stash list

2. Deleting stashes

Delete all stashes:

> git stash clear

Delete specific stash (stash id in quotes on PowerShell):

> git stash drop <stashId>

3. Save stash(es), annotated with a message

> git stash save my message...

4. Apply the most recent stash

> git stash apply

5. Apply a specific stash

> git stash apply --index 2

or use stash{0}:

> git stash apply stash@{1}

If you are using a Powershell-based command line, it won’t like the curly braces, so enclose it in quotes
and it should work:

> git stash apply "stash@{1}"

6. Remove all stashes

> git stash clear

7. View stash changes / diffs

To view a brief summary:

> git stash show

To view the full diff:

> git stash show -p

To view the full diff on a specific stash (enclose stash@.. in quotes if Powershell command line):

git stash show -p stash@{2}
`