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

前端 未结 7 2104
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-22 14:42

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

Specifically I mean, with typing in one command.

7条回答
  •  时光取名叫无心
    2020-12-22 14:50

    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 stash@{19}:

    while git stash drop 'stash@{20}'; do true; done
    

提交回复
热议问题