How to show the contents of a stash?

git stash show -p stash_name

To see the contents of a stash use git stash show -p stash_name. You can find the name of a stash from git stash list.

Layer 1
Terminal Example
git stash list
stash@{0}: WIP on main: 0e9c1e9 Readme changes
stash@{1}: WIP on main: 0e9c1e9 Readme changes
stash@{2}: WIP on main: c335861 Changes in code and README

git stash show -p stash@{2}
diff --git a/code.rb b/code.rb
index aacfbc1..ab9ee75 100644
--- a/code.rb
+++ b/code.rb
@@ -1 +1,4 @@
-# Some comments
+def say_hello(name)
+  "Hello #{name}"

See git stash to learn more about it.

Last modified on November 30, 2021.

You might also like