Skip to main content

Viewing the changes in a Git stash

Posted in Development and Git

It’s a good idea to name our stashes if some time is likely to pass between stashing and picking up the work again, but sometimes we need even more information, which is where the show command comes in:

git stash show

This will tell you the following about the most recent stash:

  • which files were changed
  • the number of changes in each file
  • the total number changes in all the files

It’s possible to specify the stash too; just find the index number of the stash you’d like more details on and run:

git stash show stash@{2}

In this example, we’d be looking at the third most recent stash.

This is a nice overview and may be enough to jog your memory, but what if you need even more?

Viewing the diff

To see the actual changes, line by line, to the files in a stash, we can use the --patch flag (or -p for short):

git stash show -p

This will show the diff of the most recently stashed stash, but of course we can choose any from our list of stashes by adding the index:

git stash show -p stash@{2}

Accessibility in your inbox

I send an accessibility-centric newsletter on the last day of every month, containing:

  • A roundup of the articles I’ve posted
  • A hot pick from my archives
  • Some interesting posts from around the web

I don’t collect any data on when, where or if people open the emails I send them. Your email will only be used to send you newsletters and will never be passed on. You can unsubscribe at any time.

More posts

Here are a couple more posts for you to enjoy. If that’s not enough, have a look at the full list.

  1. Upgrading from iPhone 13 mini to 16 Pro

    I get a new phone every 3-ish years, give mine to my wife, and now she gives hers to our daughter. I got a 16 Pro this year! Here’s the skinny.

  2. Apple, you’re doing the Dynamic Island wrong

    I love the idea of Dynamic Island; making lemons into lemonade and all that. But, in my opinion, Apple have got the fundamentals mixed up.