From df2bf83846e0a3cda9c5be67c98f920b98d47b18 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Sun, 15 Dec 2024 09:39:23 -0800 Subject: [PATCH] op/switch: more robust switching --- tools/op.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/op.sh b/tools/op.sh index 4d352af5d..d56dadc76 100755 --- a/tools/op.sh +++ b/tools/op.sh @@ -328,7 +328,8 @@ function op_switch() { BRANCH="$1" git fetch "$REMOTE" "$BRANCH" - git checkout -f --recurse-submodules --track "$REMOTE"/"$BRANCH" + git checkout -f FETCH_HEAD + git checkout -B "$BRANCH" --track "$REMOTE"/"$BRANCH" git reset --hard "${REMOTE}/${BRANCH}" git clean -df git submodule update --init --recursive