Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

git-stash

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

Specifically I mean, with typing in one command.

like image 599
Rebekah Waterbury Avatar asked Jul 06 '12 20:07

Rebekah Waterbury


People also ask

How do I delete old git stashes?

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.

How do I drop multiple stashes?

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.

Does git reset remove stashes?

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 .

What is git stash clean?

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.


1 Answers

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

like image 53
Tadeck Avatar answered Sep 25 '22 07:09

Tadeck