diff --git a/git-sh.bash b/git-sh.bash index 1891700..85be066 100644 --- a/git-sh.bash +++ b/git-sh.bash @@ -163,13 +163,16 @@ done # Create aliases for everything defined in the gitconfig [alias] section. _git_import_aliases () { eval "$( - git config --get-regexp 'alias\..*' | - sed 's/^alias\.//' | - while read key command + git config --list --name-only | + sed -n 's/^alias\.//p' | + while read key do + command=$(git config --get "alias.$key") if expr -- "$command" : '!' >/dev/null then echo "alias $key='git $key'" - else echo "gitalias $key=\"git $command\"" + else echo "gitalias $key=\"git $(set -f; printf '%s ' $command)\"" + # Newlines in aliases that are not shell commands will be + # considered whitespace (as git itself would do). fi done )"