Oh great, an answer 20 days later ... Sorry about this. I have been reading a bit on the topic and found that for Bash we should be using shell functions over aliases so I wrote this function to be simply added to the .bashrc: # 'git stash drop' confirm shell function git() { if [[ $@ == "stash drop" ]]; then read -r -p "Are you sure you want to drop your stash? [y/N] " response case "$response" in [yY][eE][sS]|[yY]) command git "$@" ;; esac else command git "$@" fi } Be careful, I'm no Bash expert and I don't believe it is fully POSIX compliant but it's a good start I think. This could also be used for the 'rm -rf' command or any other potentially dangerous command I believe. Maybe there is a place for a .bashrc_safe_shell_functions that could be loaded by the user to add confirmation before all potentially dangerous commands but it'll be for another thread. Thank you for your help guys and keep up with your excellent work on Git! All the best, Laurent On 30 June 2017 at 21:21, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Laurent Humblet <laurent.humblet@xxxxxxxxx> writes: > >> Thank you for your feedback. >> >> I suppose that turning a hypothetical confirmation option 'on' would >> impact a stash pop for instance as it automatically drops the stash if >> it was applied without conflicts. >> >> What about a --confirm flag? You could then simply alias 'git stash >> drop --confirm' locally and it wouldn't impact anything else? > > I think that is probably trivial to add, but how would you make sure > you give it? One way may be to train your fingers to type "git sd" > with something like this in your ~/.gitconfig: > > [alias] sd = "stash drop --confirm" > > but at that point, you could instead have something like the > following in you ~/bin/git-sd and get the same effect: > > #!/bin/sh > if tty -s > then > echo >&2 "are you sure you want to drop all stash entries?" > case "$(read)" in > [Yy]*) ;; > *) echo >&2 "ok, let's not drop 'em"; exit 0 ;; > esac > fi > exec git stash drop > > without adding the "--confirm" option at all. > > So I am not sure that would get us closer to a satisfactory solution > to your original problem. > > Retroactively adding an end-user safety is hard. > >> Have a great week-end! > > You too.