op.sh: more robust switch for submodules

pull/36147/head
Maxime Desroches 1 week ago
parent be379e188b
commit cbea5f198f
  1. 2
      tools/op.sh

@ -366,9 +366,11 @@ function op_switch() {
BRANCH="$1" BRANCH="$1"
git config --replace-all remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" git config --replace-all remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git submodule deinit --all --force
git fetch "$REMOTE" "$BRANCH" git fetch "$REMOTE" "$BRANCH"
git checkout -f FETCH_HEAD git checkout -f FETCH_HEAD
git checkout -B "$BRANCH" --track "$REMOTE"/"$BRANCH" git checkout -B "$BRANCH" --track "$REMOTE"/"$BRANCH"
git submodule deinit --all --force
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