I want git to require confirmation for resetting, so I updated William Pursell's suggestion written here like this:
set -e -u
if [ $# -ge 2 ]; then
if [ "x$1" = "xreset" -a "x$2" = "x--hard" ]; then
echo "Are you sure? (Type 'yes')"
read resp || return $?
if [ "x$resp" = "xyes" ]; then
echo "NOT Resetting"
command git "[email protected]" || :
Remove the line
set -e -u. Those settings are global to your shell session, not local to your function, and they conflict with the shell completion functions which are not immune to undefined variables (
set -u). And since your function is well written, you need neither
set -e nor