mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 23:28:02 +00:00
Add Look Through All Files That Have Been Git Stashed as a Unix TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
|||||||
|
|
||||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||||
|
|
||||||
_1328 TILs and counting..._
|
_1329 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -1306,6 +1306,7 @@ _1328 TILs and counting..._
|
|||||||
- [List The Available JDKs](unix/list-the-available-jdks.md)
|
- [List The Available JDKs](unix/list-the-available-jdks.md)
|
||||||
- [List The Stack Of Remembered Directories](unix/list-the-stack-of-remembered-directories.md)
|
- [List The Stack Of Remembered Directories](unix/list-the-stack-of-remembered-directories.md)
|
||||||
- [Load Env Vars In Bash Script](unix/load-env-vars-in-bash-script.md)
|
- [Load Env Vars In Bash Script](unix/load-env-vars-in-bash-script.md)
|
||||||
|
- [Look Through All Files That Have Been Git Stashed](unix/look-through-all-files-that-have-been-git-stashed.md)
|
||||||
- [Map A Domain To localhost](unix/map-a-domain-to-localhost.md)
|
- [Map A Domain To localhost](unix/map-a-domain-to-localhost.md)
|
||||||
- [Negative Look-Ahead Search With ripgrep](unix/negative-look-ahead-search-with-ripgrep.md)
|
- [Negative Look-Ahead Search With ripgrep](unix/negative-look-ahead-search-with-ripgrep.md)
|
||||||
- [Occupy A Local Port With Netcat](unix/occupy-a-local-port-with-netcat.md)
|
- [Occupy A Local Port With Netcat](unix/occupy-a-local-port-with-netcat.md)
|
||||||
|
|||||||
30
unix/look-through-all-files-that-have-been-git-stashed.md
Normal file
30
unix/look-through-all-files-that-have-been-git-stashed.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# Look Through All Files That Have Been Git Stashed
|
||||||
|
|
||||||
|
When I use `git stash`, I typically _pop_ the stash not long after to continue
|
||||||
|
working with those changes. Still, over time the stash list tends to build up,
|
||||||
|
especially if I'm bouncing between lots of different work.
|
||||||
|
|
||||||
|
I wired together a series of commands with the unix piping to make it easy to
|
||||||
|
explore the entire contents of the stash.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git stash list \
|
||||||
|
| awk -F: '{print $1}' \
|
||||||
|
| xargs -I stash-ref git stash show stash-ref --name-only \
|
||||||
|
| sort \
|
||||||
|
| uniq
|
||||||
|
```
|
||||||
|
|
||||||
|
That "one-liner" on its own gives me a uniq list of all files across all my
|
||||||
|
stashes in the current git repo.
|
||||||
|
|
||||||
|
I can then explore it by tacking on something like `fzf` or `grep`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git stash list \
|
||||||
|
| awk -F: '{print $1}' \
|
||||||
|
| xargs -I stash-ref git stash show stash-ref --name-only \
|
||||||
|
| sort \
|
||||||
|
| uniq \
|
||||||
|
| grep '.*.md'
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user