If you use a Bash shell, you can install a โcommand not found handlerโ, which is a shell function that will be run whenever a command is not recognized. You can use this to try running git-status if you run status and the shell cannot find this command, for example.
command_not_found_handle() { gitcmd=`git --exec-path`/git-$1 ; if type -a $gitcmd >/dev/null 2>&1 ; then shift ; exec $gitcmd " $@ " ; fi ; echo "bash: $1: command not found" >&2 ; return 1 ; }
This will not expand the git aliases, it only recognizes commands that exist as executables in the GIT_EXEC_PATH directory, for example /usr/libexec/git-core/git-status
master*% src$ pwd /home/jwakely/src/foo/src master*% src$ git status -s M include/foo.h ?? TODO master*% src$ status -s
If you want it to handle aliases, but with the disadvantage that any unrecognized command (including typos) will be passed to Git, you can make it a lot easier:
command_not_found_handle() { git " $@ " ; } master*% src$ st
source share