diff --git a/README.md b/README.md index 673c909..8e85f41 100644 --- a/README.md +++ b/README.md @@ -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). -_1653 TILs and counting..._ +_1654 TILs and counting..._ See some of the other learning resources I work on: - [Get Started with Vimium](https://egghead.io/courses/get-started-with-vimium~3t5f7) @@ -321,6 +321,7 @@ If you've learned something here, support my efforts writing daily TILs by - [Clean Out All Local Branches](git/clean-out-all-local-branches.md) - [Clean Out Working Copy With Patched Restore](git/clean-out-working-copy-with-patched-restore.md) - [Clean Up Old Remote Tracking References](git/clean-up-old-remote-tracking-references.md) +- [Clear Entries From Git Stash](git/clear-entries-from-git-stash.md) - [Clone A Repo Just For The Files, Without History](git/clone-a-repo-just-for-the-files-without-history.md) - [Clone A Repo Locally From .git](git/clone-a-repo-locally-from-git.md) - [Configure Global gitignore File](git/configure-global-gitignore-file.md) diff --git a/git/clear-entries-from-git-stash.md b/git/clear-entries-from-git-stash.md new file mode 100644 index 0000000..9da067a --- /dev/null +++ b/git/clear-entries-from-git-stash.md @@ -0,0 +1,26 @@ +# Clear Entries From Git Stash + +I often stash changes as I'm moving between branches, rebasing, or pulling in +changes from the remote. Usually these are changes that I will want to restore +with a `git stash pop` in a few moments. + +However, sometimes these stashed changes are abandoned to time. + +When I run `git stash list` on an active project, I see that there are nine +entries in the list. When I do `git show stash@{0}` and `git show stash@{1}` to +see the changes that comprise the latest two entries, I don't see anything I +care about. + +I can get rid of those individual entries with, say, `git stash drop +stash@{0}`. + +But I'm pretty confident that I don't care about any of the nine entries in my +stash list, so I want to _clear_ out all of them. I can do that with: + +```bash +$ git stash clear +``` + +Now when I run `git stash list`, I see nothing. + +See `man git-stash` for more details.