Skip to content

Instantly share code, notes, and snippets.

@caius
Created June 19, 2009 16:10
Show Gist options
  • Save caius/132706 to your computer and use it in GitHub Desktop.
Save caius/132706 to your computer and use it in GitHub Desktop.

List my stashes:

Julius:myapp(311-features) caius$ git stash list
stash@{0}: WIP on 445-specs: ac063a3 Fleshing out specs.

As you can see I have a stash on a different branch, now I want to see what the changes in the stash are. I wonder if git stash show will tell me that:

Julius:myapp(311-features) caius$ git stash show stash@{0}
 spec/models/my_model_spec.rb |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

Hmm, that tells me its only going to affect one file, but what changes does it have. I think I'll have a go with git diff now. If I git diff HEAD..stash@{0} then it'll diff all my changes I've committed since. Lets try diffing against the commit the stash was made on top of.

From the stash list I can see the SHA1 of said commit ac063a3, and I know how to reference the stash using stash@{0}. Lets give that a go

Julius:myapp(311-features) caius$ git diff ac063a3..stash@{0}
diff --git a/spec/models/my_model_spec.rb b/spec/models/my_model_spec.rb
@@ -42,10 +42,20 @@ describe MyModel do
+ # Like I'm showing you my code.
- # ZOMG CODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment