bash: gc: set default branch programatically
Signed-off-by: Michael Grote <michael.grote@posteo.de>
This commit is contained in:
parent
61d46d5652
commit
95a5492483
1 changed files with 4 additions and 4 deletions
|
@ -150,11 +150,11 @@ EOF
|
|||
*)
|
||||
if [ ! -z $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!")
|
||||
(echo ">>> Try remote checkout" && git checkout --quiet -b "$1" origin/"$1" > /dev/null 2>&1 || echo ">>> Unknown 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')
|
||||
echo ">>> get default branch"
|
||||
default_branch=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')
|
||||
git checkout --quiet ${default_branch} > /dev/null 2>&1
|
||||
fi
|
||||
esac
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue