git: add autoSetupRemote

Signed-off-by: Michael Grote <michael.grote@dataport.de>
This commit is contained in:
Michael Grote 2024-09-16 08:53:38 +02:00 committed by Michael Grote
parent 2dedcfda5a
commit 6c0afe7a41
2 changed files with 3 additions and 2 deletions

View file

@ -13,7 +13,8 @@ autocorrect = 20 # https://opensource.com/article/20/11/git-aliases
[status]
showUntrackedFiles = all
[push]
default = simple
default = current
autoSetupRemote = true
[pull]
rebase = true
autostash = true

View file

@ -18,7 +18,7 @@ case "$1" in
EOF
;;
--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... ')
(git checkout --quiet -b "$2" && echo '>>> Create new branch "'"$2"'"') || (git checkout --quiet "$2" > /dev/null 2>&1 && echo '>>> Branch already exists, checking out... ')
;;
*)
if [ -n "$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! ")