op/switch: more robust switching

pull/34251/head
Adeeb Shihadeh 4 months ago committed by GitHub
parent d735db6113
commit df2bf83846
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      tools/op.sh

@ -328,7 +328,8 @@ function op_switch() {
BRANCH="$1" BRANCH="$1"
git fetch "$REMOTE" "$BRANCH" 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 reset --hard "${REMOTE}/${BRANCH}"
git clean -df git clean -df
git submodule update --init --recursive git submodule update --init --recursive

Loading…
Cancel
Save