Skip to content

Commit 2958563

Browse files
committed
Add Show What Is In A Stash as a git til
1 parent a20c14d commit 2958563

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
1010
For a steady stream of TILs from a variety of rocketeers, checkout
1111
[til.hashrocket.com](https://til.hashrocket.com/).
1212

13-
_712 TILs and counting..._
13+
_713 TILs and counting..._
1414

1515
---
1616

@@ -198,6 +198,7 @@ _712 TILs and counting..._
198198
- [Show List Of Most Recently Committed Branches](git/show-list-of-most-recently-committed-branches.md)
199199
- [Show The diffstat Summary Of A Commit](git/show-the-diffstat-summary-of-a-commit.md)
200200
- [Show The Good And The Bad With Git Bisect](git/show-the-good-and-the-bad-with-git-bisect.md)
201+
- [Show What Is In A Stash](git/show-what-is-in-a-stash.md)
201202
- [Single Key Presses in Interactive Mode](git/single-key-presses-in-interactive-mode.md)
202203
- [Staging Changes Within Vim](git/staging-changes-within-vim.md)
203204
- [Staging Stashes Interactively](git/staging-stashes-interactively.md)

git/show-what-is-in-a-stash.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Show What Is In A Stash
2+
3+
Usually when I want to inspect anything in git, I'll use `git show` with a
4+
specific ref. This can even be done with stash refs.
5+
6+
```bash
7+
$ git stash list
8+
stash@{0}: WIP on ...
9+
stash@{1}: Some commit on ...
10+
11+
$ git show stash@{0}
12+
# ...
13+
```
14+
15+
The `git-stash` command has a built-in way of showing stashes that will save
16+
you from having to type out the somewhat awkward `stash@{n}` ref.
17+
18+
```bash
19+
$ git stash show 1
20+
```
21+
22+
This will show you the `stash@{1}` ref. You can also omit a number which
23+
will show you the latest stash (`stash@{0}`).
24+
25+
See `man git-stash` for more details.

0 commit comments

Comments
 (0)