3

I have the following stash list (git stash list):

stash@{0}: WIP on foobar: baz qux
stash@{1}: WIP on worble: norf 
stash@{2}: On blazbliz: finishes blah 
stash@{3}: WIP on foobar: baz qux in progress
stash@{4}: WIP on wizzle: wuzzle 
stash@{5}: On wiggle: wiggle 
stash@{6}: On blah: yada 
stash@{7}: WIP on hello: started hello world 

How do I drop all stashes after a certain point? say for example all stashes after stash@{2} so that I end up with

stash@{0}: WIP on foobar: baz qux
stash@{1}: WIP on worble: norf 
stash@{2}: On blazbliz: finishes blah
risto
  • 1,274
  • 9
  • 11

1 Answers1

5

git stash drop is used to drop a stash.

git stash drop drops the top stash - or a stash reference which looks like: stash@{n} which n nominates which stash to drop.

Hence, git stash drop stash@{1} will remove the stash at place 1.

So, it's not possible to drop a list of stash.

Alternatively, all the stash are stored at .git/logs/refs/stash. Each line contains 1 stash in the reverse order in which they were created. (Latest will be at the top)

So, to drop multiple stash at once, open the file from your projects home dir, delete as many as you want and save it.

Pankaj Singhal
  • 15,283
  • 9
  • 47
  • 86