fix(deploy): use git fetch and git reset --hard origin/main in deployment script

This commit is contained in:
2026-08-11 09:19:48 +08:00
parent ec3c00ffff
commit 03ea015c38

View File

@@ -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;