The git drop stash
command allows you to delete a specific stash. It has the following syntax (where n
is the stash index):
# drop stash at index 'n' git stash drop stash@{n}
If you do not provide the stash index, it would drop the stash at index 0
(i.e. the top stash):
# drop top hash; stash@{0} git stash drop
Please note that when you drop a stash, all other stash indexes are re-indexed. This means that, for example, if you drop a stash at index 1, stashes at index 2 and 3 become stashes 1 and 2 respectively. Therefore, you should be extra careful with this, especially when you want to drop multiple stashes. In that case you should remove them in reverse order (i.e. larger index first). For example, suppose you want to delete stashes 1, 2 and 3; the correct way to drop them would be in reverse, i.e. 3, 2, 1.
Hope you found this post useful. It was published . Please show your love and support by sharing this post.