Skip to content

Instantly share code, notes, and snippets.

@oakfang
Created June 13, 2016 14:39
Show Gist options
  • Save oakfang/3942ae67df692469fe24729ebb86da20 to your computer and use it in GitHub Desktop.
Save oakfang/3942ae67df692469fe24729ebb86da20 to your computer and use it in GitHub Desktop.
One command to rule them all.
# 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