Laurent Humblet <laurent.humb...@gmail.com> writes: > Would it be possible to add an optional Yes/No when doing a 'git stash > drop'? Something similar as what happens when pushing on a remotely > checked out branch (with a config setting to turn the warning on/off). > > I know that you can always get your dropped stash back using git > reflog but a small warning might be a useful feature to avoid unwanted > stash drops on a regular basis.
I sympathize with this, but the same principle also would apply many destructive commands like "git reset --hard", "git rm <path>", etc. and also "/bin/rm -f" ;-) I however do not think a good general way to do this without breaking people's scripts. When they do 'stash drop' in their scripts, they know they want to get rid of the dropped stash entries, and they expect that the user may not necessarily be sitting in front of the shell to give the command a Yes (they probably wouldn't even give the user a message "the next step may ask you to say Yes; please do so"). On the other hand, just like "git reset --hard" and "git clean -f" does not have such safety (i.e. the user is aware that the command is destructive by giving "--hard" and "-f"), "drop" may be a sign that the user knowingly doing something destructive. So I dunno.