How can I delete all of my Git stashes at once?
Specifically I mean, with typing in one command.
Go to Source Control tab. Check the STASHES section. You will find all your stashes (same like git stash list ) You will find direct buttons to Apply Stash, Compare with HEAD and Delete Stash respectively for each stash.
Therefore, to drop three stashes, starting with #1, simply drop stash #1 three times. Slight improvement to your answer. Rather, to avoid confusion and adjusting the stash id's while dropping, simply git stash drop stash@{id} in descending order of id's.
No, git reset --hard origin/master does not affect your stashes in any way. Show activity on this post. The hard reset command you showed above would move the HEAD pointer of whatever the current branch might be to origin/master , but it would not affect the stash commits, which are stored in . git/refs/stash .
DESCRIPTION. Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.
The following command deletes all your stashes:
git stash clear
From the git documentation:
clear
Remove all the stashed states.
IMPORTANT WARNING: Those states will then be subject to pruning, and may be impossible to recover (...).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With