From 03ea015c388ace2083e312f53396de93bee8d651 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 11 Aug 2026 09:19:48 +0800 Subject: [PATCH] fix(deploy): use git fetch and git reset --hard origin/main in deployment script --- public/git-pull.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/public/git-pull.php b/public/git-pull.php index 56127f2f8..797664323 100644 --- a/public/git-pull.php +++ b/public/git-pull.php @@ -138,8 +138,9 @@ if (file_exists('public/optimize.php')) { execute("git reset --hard HEAD 2>&1"); execute("git clean -fd 2>&1"); // Force clean untracked files and directories -// 2. Pull latest changes -execute("git pull origin main 2>&1"); +// 2. Pull latest changes (fetch & hard reset to origin/main to handle force pushes cleanly) +execute("git fetch origin main 2>&1"); +execute("git reset --hard origin/main 2>&1"); // 4. Re-optimize Laravel cache and run migrations $phpBin = PHP_BINARY;