diff --git a/.bash_extra b/.bash_extra index 4ecd45c..6c450d4 100644 --- a/.bash_extra +++ b/.bash_extra @@ -122,36 +122,36 @@ function gcm { } function gc { case "$1" in - --help | -h) - cat <>> Create new branch "'"$2"'"') || + ;; + --new-branch | -b) + (git checkout --quiet -b "$2" && git push --set-upstream "$(git remote | head -n 1)" "$2" && echo '>>> Create new branch "'"$2"'"') || (git checkout --quiet "$2" > /dev/null 2>&1 && echo '>>> Branch already exists, checking out... ') - ;; - *) - if [ ! -z $1 ] ; then - (echo ">>> Try local checkout" && git checkout --quiet "$1" > /dev/null 2>&1) || - (echo ">>> Try remote checkout" && git checkout --quiet -b "$1" origin/"$1" > /dev/null 2>&1 || echo ">>> Unkown branch!") - else - (git checkout --quiet master > /dev/null 2>&1 && echo '>>> Try checking out master') || - (git checkout --quiet main > /dev/null 2>&1 && echo '>>> Try checking out main') || - (git checkout --quiet release > /dev/null 2>&1 && echo '>>> Try checking out release') - fi + ;; + *) + if [ ! -z $1 ] ; then + (echo ">>> Try local checkout" && git checkout --quiet "$1" > /dev/null 2>&1) || + (echo ">>> Try remote checkout" && git checkout --quiet -b "$1" origin/"$1" > /dev/null 2>&1 || echo ">>> Unkown branch!") + else + (git checkout --quiet master > /dev/null 2>&1 && echo '>>> Try checking out master') || + (git checkout --quiet main > /dev/null 2>&1 && echo '>>> Try checking out main') || + (git checkout --quiet release > /dev/null 2>&1 && echo '>>> Try checking out release') + fi esac } function glogs { @@ -250,9 +250,3 @@ alias dcr="docker-compose down && docker-compose up -d" alias mv="mv -i " alias cp="cp -i " alias rm="rm -i " -# rest -alias suspend="~/dotfiles/scripts/pwr.sh -sd" -alias hibernate="~/dotfiles/scripts/pwr.sh -hb" -alias restart="~/dotfiles/scripts/pwr.sh -r" -alias shutdown="~/dotfiles/scripts/pwr.sh -s" -alias reboot="~/dotfiles/scripts/pwr.sh -r"