diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index 802bab3..ec7e10d 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -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."