This commit is contained in:
parent
e784de468e
commit
360133560e
1 changed files with 3 additions and 7 deletions
|
@ -75,17 +75,13 @@ function gc {
|
||||||
EOF
|
EOF
|
||||||
;;
|
;;
|
||||||
--new-branch | -b)
|
--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 -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 "$2" > /dev/null 2>&1 && echo '>>> Branch already exists, checking out... ')
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ ! -z $1 ] ; then
|
if [ ! -z $1 ] ; then
|
||||||
(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!")
|
|
||||||
else
|
else
|
||||||
(git checkout --quiet master > /dev/null 2>&1 && echo '>>> Try checking out master') ||
|
(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')
|
||||||
(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
|
fi
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue