git push server-name
我有一個會產生重大後果的命令 ( )。如何要求確認僅此命令?它應該忽略空白。
確認可以是Enter 'yes i am sure.' to confirm:
順便說一下,還有一個不需要確認的指令:git push server-name-staging
。
答案1
git
您要編寫的腳本的別名:
$ alias git=mygit
……它住在你的PATH
某個地方,看起來像這樣:
#!/bin/sh
if [ "$1" = "push" ]
then
/bin/echo -n "Enter 'yes i am sure.' to confirm: "
read answer
if [ "$answer" != "yes i am sure." ]
then
echo So indecisive...
exit 1
fi
fi
git "$@"