How can I delete all of my Git stashes at once? – Dev

The best answers to the question “How can I delete all of my Git stashes at once?” in the category Dev.


How can I delete all of my Git stashes at once?

Specifically I mean, with typing in one command.


There are two ways to delete a stash:

  1. If you no longer need a particular stash, you can delete it with: $ git stash drop <stash_id>.
  2. You can delete all of your stashes from the repo with: $ git stash clear.

Use both of them with caution, it maybe is difficult to revert the once deleted stashes.

Here is the reference article.


The following command deletes all your stashes:

git stash clear

From the git documentation:


Remove all the stashed states.

IMPORTANT WARNING: Those states will then be subject to pruning, and may be impossible to recover (…).


I wanted to keep a few recent stashes, but delete everything else.

Because all stashes get renumbered when you drop one, this is actually easy to do with while. To delete all stashes older than [email protected]{19}:

while git stash drop '[email protected]{20}'; do true; done


this command enables you to look all stashed changes.

git stash list

Here is the following command use it to clear all of your stashed Changes

git stash clear

Now if you want to delete one of the stashed changes from stash area

git stash drop [email protected]{index}   // here index will be shown after getting stash list.

Note : git stash list enables you to get index from stash area of git.