git hoge って打つのがめんどい

$ hoge

git レポジトリの中にいたら git hoge を、そうでなければ hoge というコマンドを実行するような trygitcmd 関数を定義してエイリアスした。

alias status='trygitcmd status'
alias st='trygitcmd status'
alias push='trygitcmd push'
alias pull='trygitcmd pull'
alias commit='trygitcmd commit'
alias ci='trygitcmd commit'
alias diff='trygitcmd diff'
alias branch='trygitcmd branch'
alias omake='omake --verbose'

function trygitcmd(){
    if (which git > /dev/null) && (git branch 1>/dev/null 2>/dev/null); then
	command git "$@"
    else
	command "$@"
    fi
}