bash: gc: ersetze Variable durch subshell

This commit is contained in:
Michael Grote 2022-07-25 19:14:38 +02:00
parent 800ab35760
commit 622bb52652

View file

@ -182,15 +182,14 @@ Author:
EOF EOF
;; ;;
--new-branch | -b) --new-branch | -b)
REMOTE=$(git remote | head -n 1) (git checkout --quiet -b "$2" && git push --set-upstream "$(git remote | head -n 1)" "$2" && echo '>>> Create new branch "'"$2"'"') ||
(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... ') (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 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!") (echo ">>> Try remote checkout" && git checkout --quiet -b "$1" origin/"$1" > /dev/null 2>&1 || echo ">>> Unkown branch!")
esac esac
} }
### Aliase ### Aliase
# tmux # tmux
alias tmuxa="tmux a -t " alias tmuxa="tmux a -t "