gitgithubgit-stash

Is it possible to drop a specific stash from the stash list in git?


With git stash list, I see the list of stashes, Is it possible to drop a stash from somewhere in the middle of the stash list and not from the top.


Solution

  • Sure, git stash --help says:

       git stash drop [-q|--quiet] [<stash>]
    

    So you can specify a stash to drop (with the default being the most recent stash). For example:

    git stash drop stash@{5}
    

    stash@{5} is the sequential label as shown in git stash list. Note it is not stable over time--once you drop stash 5, stash 6 will then be called stash 5.