Created
February 7, 2020 20:38
generate aliases from git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generate aliases from gitconfig aliases | |
function generateAliasesFromGit() { | |
git config --get-regexp ^alias\\. | while read gitAlias; do | |
local aliasName=$(echo $gitAlias | sed -E 's/^alias\.([a-z_\-]*).*/\1/') | |
# alias only if there is no collision | |
if ! type "g$aliasName" >/dev/null 2>&1; then | |
alias g$aliasName="git $aliasName" | |
fi | |
done | |
} | |
generateAliasesFromGit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment