From cdeac31f1f68c0e6ebd491915c4b19242f4e7386 Mon Sep 17 00:00:00 2001 From: Lucas Larson Date: Tue, 28 Jun 2022 14:38:39 -0400 Subject: [PATCH] pass certain commands and arguments to bare `git` Signed-off-by: Lucas Larson --- custom/aliases.zsh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/custom/aliases.zsh b/custom/aliases.zsh index 0a0169d908..2effd57e23 100644 --- a/custom/aliases.zsh +++ b/custom/aliases.zsh @@ -719,14 +719,21 @@ find_shell_scripts() { unalias -- 'g' 2>/dev/null compdef g='git' 2>/dev/null g() { - command git rev-parse --is-inside-work-tree >/dev/null 2>&1 || - return "${?:-1}" - # if first argument is a file, then perform `git status` on it - if test -e "${1-}"; then - command git status -- "$@" - else - command git "${@:-status}" - fi + case "${1-}" in + clone | config | help | init | version | -*) + command git "$@" + ;; + *) + command git rev-parse --is-inside-work-tree >/dev/null 2>&1 || + return "${?:-1}" + # if first argument is a file, then perform `git status` on it + if test -e "${1-}"; then + command git status -- "$@" + else + command git "${@:-status}" + fi + ;; + esac } alias g.='command git status .' alias guo='command git status --untracked-files=no'