Check if the dev branch exists before moving to it.
This commit is contained in:
@@ -928,8 +928,17 @@
|
||||
git ls-remote --heads | sort
|
||||
|
||||
if [[ "$base" != "dev" ]]; then
|
||||
echo -e "\n* Switching back to dev."
|
||||
git switch dev
|
||||
git ls-remote --exit-code --heads origin dev
|
||||
dev_exists="$?"
|
||||
if [[ "$dev_exists" == 0 ]]; then
|
||||
echo -e "\n* Switching back to dev."
|
||||
git switch dev
|
||||
elif [[ "$dev_exists" == 2 ]]; then
|
||||
echo -e "\n* Switching back to main."
|
||||
git switch main
|
||||
else
|
||||
echo "*** ERROR: Unknown status for dev_exists, '$dev_exists'. ***"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "\n* Verifying which branch we're on."
|
||||
|
Reference in New Issue
Block a user