alias g='git' __git_aliases() { local IFS=$'\n' for _git_config_line in $(git config --list | grep -E '^alias\.' | cut -d. -f2-); do if ! which "g${_git_config_line%%=*}" &>/dev/null; then if [[ ${_git_config_line} = *'=!'* ]]; then alias "g${_git_config_line:s/=\!/=}" else alias "g${_git_config_line:s/=/=git }" fi fi done } __git_aliases unset __git_aliases