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

Solution 1:

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

Solution 2:

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.

Solution 3:

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 stash@{index} # Index will be shown after getting stash list

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