Created
June 13, 2016 14:39
-
-
Save oakfang/3942ae67df692469fe24729ebb86da20 to your computer and use it in GitHub Desktop.
One command to rule them all.
This file contains hidden or 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
# Source this from your .bashrc/.zshrc | |
GIT_CORE="$(git --exec-path)" | |
gn() { | |
command=$1 | |
shift | |
if [ -f "${GIT_CORE}/git-${command}" ]; then | |
git "$command" "$@" | |
else | |
if hash "git-${command}" 2>/dev/null; then | |
git "$command" "$@" | |
else | |
npm "$command" "$@" | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment