fix: use git fetch <branch> + checkout -B FETCH_HEAD for reliable branch switching
This commit is contained in:
+3
-3
@@ -18,9 +18,9 @@ fi
|
||||
DEPLOY_BRANCH="${DEPLOY_BRANCH:-main}"
|
||||
|
||||
echo ">>> 拉取最新代码(分支: $DEPLOY_BRANCH,强制覆盖本地修改)..."
|
||||
git fetch origin
|
||||
git checkout "$DEPLOY_BRANCH"
|
||||
git reset --hard "origin/$DEPLOY_BRANCH"
|
||||
git fetch origin "$DEPLOY_BRANCH"
|
||||
git checkout -B "$DEPLOY_BRANCH" FETCH_HEAD
|
||||
echo ">>> 当前 commit: $(git rev-parse --short HEAD) $(git log -1 --format=%s)"
|
||||
|
||||
echo ">>> 安装前端依赖并构建..."
|
||||
cd frontend
|
||||
|
||||
Reference in New Issue
Block a user