From 800ab35760b996f3db7aa5736bac86eea477696c Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Mon, 25 Jul 2022 17:31:09 +0200 Subject: [PATCH] bash: gc: setze Upstream bei Checkout --- .bash_extra | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/.bash_extra b/.bash_extra index 9a16e9b..672165b 100644 --- a/.bash_extra +++ b/.bash_extra @@ -180,27 +180,17 @@ Options: Author: michael.grote@posteo.de - git.mgrote.net EOF - ;; --new-branch | -b) - (git checkout --quiet -b "$2" > /dev/null 2>&1 && echo '>>> Create new branch "'"$2"'"') || + ;; + --new-branch | -b) + REMOTE=$(git remote | head -n 1) + (git checkout --quiet -b "$2" && git push --set-upstream "$REMOTE" "$2" && echo '>>> Create new branch "'"$2"'"') || (git checkout --quiet "$2" > /dev/null 2>&1 && echo '>>> Branch already exists, checking out... ') ;; *) (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!") esac -} -function ll { - if command -v exa >/dev/null ; then - exa --long --git --all --ignore-glob='.git' --group-directories-first --sort=name --group "$@" - else - ls -lah "$@" - fi -} -function gs { - echo "* = unstaged // + = staged // $ = stashed // % = untracked" - git status --show-stash -} - +} ### Aliase # tmux alias tmuxa="tmux a -t "