How To See Git Stash Changes

March 24, 2020

Show most recent stash’s contents

If you want jus the most recent changes then run the following command:

git stash show -p

Show specific stash contents

To get the contents of a specific stash in your stash history you need to pass in the reference value for that particular stash.

git stash show {stashRef} -p

You can see the stashRefs, along with all the stashes you currently have, by using the following command:

git stash list

For example,

git stash list
stash@{0}: WIP on master: 8382b08 change menu icon to close
stash@{1}: WIP on visualizing-apple: 0d32414 first draft of visualizing apple

The stashRef value is stored in the @{stashRef}, in this case, 0 and 1. If we want to see the contents of the second stash we would type:

git stash show 1 -p

This will give you a diff of changes for that stash:

diff --git a/package-lock.json b/package-lock.json
index 3eb2707..71465d5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14170,6 +14170,11 @@
         "scheduler": "^0.18.0"
       }
     },
+    "react-render-to-json": {
+      "version": "0.0.6",
+      "resolved": "https://registry.npmjs.org/react-render-to-json/-/react-render-to-json-0.0.6.tgz",
+      "integrity": "sha512-fMfqnDjO2HHeg3k4dVierDxVQUymaTfWlsL9pfkSNHpXhGey1J/T8CDsVhN+xjswFYSM30zL0dLBiGHqGoAWWg=="
+    },