gc: indentation

Signed-off-by: Michael Grote <michael.grote@dataport.de>
This commit is contained in:
Michael Grote 2024-09-16 10:04:01 +02:00
parent 40e811b380
commit 75abc6a578

View file

@ -1,28 +1,33 @@
#!/bin/bash #!/bin/bash
case "$1" in case "$1" in
--help | -h) --help | -h)
cat <<EOF cat <<EOF
Description: Description:
"git checkout" on steroids "git checkout" on steroids
Usage: Usage:
gc [--help|--new-branch] [branch] gc [--help|--new-branch] [branch]
Options: Options:
-h, --help Print this help. -h, --help Print this help.
-b, --new-branch Create a new Branch instead changing to an existing branch. -b, --new-branch Create a new Branch instead changing to an existing branch.
Author: Author:
michael.grote@posteo.de - git.mgrote.net michael.grote@posteo.de - git.mgrote.net
EOF EOF
;; ;;
--new-branch | -b) --new-branch | -b)
(git checkout --quiet -b "$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! ") *)
else if [ -n "$1" ] ; then
(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') (echo ">>> Try local checkout" && git checkout --quiet "$1" > /dev/null 2>&1) || \
fi (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 esac