mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-11-05 14:01:16 +08:00
fix(git): improve ggu, ggl, gp, ggfl, ggp functions (#13370)
Co-authored-by: Hans Kristian Kismul <hans.kristian.kismul@finn.no>
This commit is contained in:
parent
caba9ae034
commit
f1934d2c76
@ -280,10 +280,11 @@ alias gpra='git pull --rebase --autostash'
|
|||||||
alias gprav='git pull --rebase --autostash -v'
|
alias gprav='git pull --rebase --autostash -v'
|
||||||
|
|
||||||
function ggu() {
|
function ggu() {
|
||||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
local b
|
||||||
git pull --rebase origin "${b:=$1}"
|
[[ "$#" != 1 ]] && b="$(git_current_branch)"
|
||||||
|
git pull --rebase origin "${b:-$1}"
|
||||||
}
|
}
|
||||||
compdef _git ggu=git-checkout
|
compdef _git ggu=git-pull
|
||||||
|
|
||||||
alias gprom='git pull --rebase origin $(git_main_branch)'
|
alias gprom='git pull --rebase origin $(git_main_branch)'
|
||||||
alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
|
alias gpromi='git pull --rebase=interactive origin $(git_main_branch)'
|
||||||
@ -295,11 +296,12 @@ function ggl() {
|
|||||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||||
git pull origin "${*}"
|
git pull origin "${*}"
|
||||||
else
|
else
|
||||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
local b
|
||||||
git pull origin "${b:=$1}"
|
[[ "$#" == 0 ]] && b="$(git_current_branch)"
|
||||||
|
git pull origin "${b:-$1}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
compdef _git ggl=git-checkout
|
compdef _git ggl=git-pull
|
||||||
|
|
||||||
alias gluc='git pull upstream $(git_current_branch)'
|
alias gluc='git pull upstream $(git_current_branch)'
|
||||||
alias glum='git pull upstream $(git_main_branch)'
|
alias glum='git pull upstream $(git_main_branch)'
|
||||||
@ -307,10 +309,11 @@ alias gp='git push'
|
|||||||
alias gpd='git push --dry-run'
|
alias gpd='git push --dry-run'
|
||||||
|
|
||||||
function ggf() {
|
function ggf() {
|
||||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
local b
|
||||||
git push --force origin "${b:=$1}"
|
[[ "$#" != 1 ]] && b="$(git_current_branch)"
|
||||||
|
git push --force origin "${b:-$1}"
|
||||||
}
|
}
|
||||||
compdef _git ggf=git-checkout
|
compdef _git ggf=git-push
|
||||||
|
|
||||||
alias gpf!='git push --force'
|
alias gpf!='git push --force'
|
||||||
is-at-least 2.30 "$git_version" \
|
is-at-least 2.30 "$git_version" \
|
||||||
@ -318,10 +321,11 @@ is-at-least 2.30 "$git_version" \
|
|||||||
|| alias gpf='git push --force-with-lease'
|
|| alias gpf='git push --force-with-lease'
|
||||||
|
|
||||||
function ggfl() {
|
function ggfl() {
|
||||||
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
|
local b
|
||||||
git push --force-with-lease origin "${b:=$1}"
|
[[ "$#" != 1 ]] && b="$(git_current_branch)"
|
||||||
|
git push --force-with-lease origin "${b:-$1}"
|
||||||
}
|
}
|
||||||
compdef _git ggfl=git-checkout
|
compdef _git ggfl=git-push
|
||||||
|
|
||||||
alias gpsup='git push --set-upstream origin $(git_current_branch)'
|
alias gpsup='git push --set-upstream origin $(git_current_branch)'
|
||||||
is-at-least 2.30 "$git_version" \
|
is-at-least 2.30 "$git_version" \
|
||||||
@ -336,11 +340,12 @@ function ggp() {
|
|||||||
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
|
||||||
git push origin "${*}"
|
git push origin "${*}"
|
||||||
else
|
else
|
||||||
[[ "$#" == 0 ]] && local b="$(git_current_branch)"
|
local b
|
||||||
git push origin "${b:=$1}"
|
[[ "$#" == 0 ]] && b="$(git_current_branch)"
|
||||||
|
git push origin "${b:-$1}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
compdef _git ggp=git-checkout
|
compdef _git ggp=git-push
|
||||||
|
|
||||||
alias gpu='git push upstream'
|
alias gpu='git push upstream'
|
||||||
alias grb='git rebase'
|
alias grb='git rebase'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user