File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,7 +28,12 @@ if [[ -n "${_requested_branch}" && -d "${SCRIPT_DIR}/.git" ]]; then
2828 if [[ " ${_current_branch} " != " ${_requested_branch} " ]]; then
2929 echo " → Switching to branch '${_requested_branch} ' before loading…"
3030 git -C " ${SCRIPT_DIR} " fetch --prune --quiet
31- git -C " ${SCRIPT_DIR} " checkout --quiet -- " ${_requested_branch} "
31+ if ! git -C " ${SCRIPT_DIR} " rev-parse --verify --quiet " origin/${_requested_branch} " > /dev/null 2>&1 \
32+ && ! git -C " ${SCRIPT_DIR} " rev-parse --verify --quiet " ${_requested_branch} " > /dev/null 2>&1 ; then
33+ echo " ✗ Branch '${_requested_branch} ' does not exist locally or on the remote."
34+ exit 1
35+ fi
36+ git -C " ${SCRIPT_DIR} " checkout --quiet " ${_requested_branch} "
3237 git -C " ${SCRIPT_DIR} " pull --rebase --quiet 2> /dev/null || true
3338 echo " ✓ Branch switched. Restarting script…"
3439 exec " ${SCRIPT_DIR} /$( basename " ${BASH_SOURCE[0]} " ) " " $@ "
You can’t perform that action at this time.
0 commit comments