From 18fef514b3dbf3f6703b611aa1b03b39a651d845 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 30 Jun 2026 13:06:14 +0800 Subject: [PATCH] fix: robust git cleanup in git-pull script --- public/git-pull.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/git-pull.php b/public/git-pull.php index 5d47c5817..308eb5569 100644 --- a/public/git-pull.php +++ b/public/git-pull.php @@ -121,15 +121,22 @@ if (isset($_GET['remote'])) { // 1. Check current status execute("git status 2>&1"); -// Delete untracked local git-pull.php in root directory if present +// Delete untracked local files that might cause merge conflicts if (file_exists('git-pull.php')) { echo "Cleaning up local untracked git-pull.php root file to prevent conflict...\n"; @unlink('git-pull.php'); echo "-----------------------------------------\n"; } +if (file_exists('public/optimize.php')) { + echo "Cleaning up local untracked public/optimize.php file to prevent conflict...\n"; + @unlink('public/optimize.php'); + echo "-----------------------------------------\n"; +} + // Discard any local modifications on the server to prevent pull aborts 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");