Posted almost 9 years ago. Visible to the public.

Git: How to look at the stash

Browsing the git stash is a bit tricky. Here is how to see the changes without applying them:

git command on the console

The following will give you the diff of the topmost stash item:

Copy
git stash show -u

But what about other items on the stash?
Well, you can list them like this:

Copy
$ git stash list stash@{0}: WIP on feature/foo stash@{1}: WIP on feature/bar stash@{2}: WIP on fix/baz

All those stashed changes have their own reference (like branch names) that you can look at, like stash@{0}, stash@{1}, etc.
Above, we looked at stash@{0} which is the default for stash actions.

So, to look at the second item, you can now say:

Copy
git stash show stash@{1} -u

Using tig

To show all items in the stash (you can see the diff by pressing Enter on a stash):

Copy
tig stash

As explained above, each item on the stash has its reference. You can use that for tig just as well:

Copy
tig stash@{2}

Using gitg

Gitg will show you items from the stash at the top of the history. Nothing to do except selecting them. :)

stash items in gitg

Growing Rails Applications in Practice
Check out our new e-book:
Learn to structure large Ruby on Rails codebases with the tools you already know and love.

Owner of this card:

Avatar
Arne Hartherz
Last edit:
almost 6 years ago
by Judith Roth
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more