#!/bin/bash case "$1" in --help | -h) cat <>> 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 (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