1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-12-25 00:31:31 +01:00

zsh: git: do not fail when aliases are undefined

This commit is contained in:
bretello 2022-08-18 16:37:24 +02:00
parent b2df319e18
commit 72a02e22e0
Signed by: brethil
GPG Key ID: 876AAC6290170FE7

View File

@ -75,7 +75,14 @@ function git-show-changes(){
git log --reverse HEAD^..
}
unalias gco
# oh-my-zsh has some aliases which we might want to override
# with functions
function _disable_alias() {
[[ -n $(alias "$1") ]] && unalias "$1"
}
_disable_alias gco
function gco() {
if [[ "$#" -ge 1 ]]; then
g checkout $@
@ -85,7 +92,8 @@ function gco() {
}
unalias gcor
_disable_alias gcor
function gcor() {
if [[ "$#" -ge 1 ]]; then
g checkout $@
@ -95,7 +103,7 @@ function gcor() {
}
unalias gbd
_disable_alias gbd
function gbd() {
if [[ "$#" -ge 1 ]]; then
g branch -d $@
@ -105,7 +113,7 @@ function gbd() {
}
unalias gbD
_disable_alias gbD
function gbD() {
if [[ "$#" -ge 1 ]]; then
g branch -D $@
@ -113,4 +121,3 @@ function gbD() {
g branch -D $(gb | fzf -m)
fi
}