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


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

Specifically I mean, with typing in one command.

10/29/2013 8:56:08 PM

Accepted Answer

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 (...).

6/20/2020 9:12:55 AM

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.


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.


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

if you want to remove the latest stash or at any particular index -

git stash drop type_your_index

> git stash list

  [email protected]{0}: abc
  [email protected]{1}: xyz
  [email protected]{1}: pqr

> git stash drop 0

  Dropped refs/[email protected]{0}

> git stash list

  [email protected]{0}: xyz
  [email protected]{1}: pqr

if you want to remove all the stash at once -

> git stash clear

> git stash list

Warning : Once done you can not revert back your stash


I had another requirement like only few stash have to be removed, below code would be helpful in that case.

for i in `seq 5 8`
   git stash drop [email protected]{$i}

/* will delete from 5 to 8 index*/