From 93986c6e7c8893ae3068bb3ea2ba187e5e1d6f43 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Fri, 04 Aug 2023 05:29:46 +0000
Subject: [PATCH] update pull strategy

---
 quartz/bootstrap-cli.mjs |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/quartz/bootstrap-cli.mjs b/quartz/bootstrap-cli.mjs
index 6387535..04ed3a2 100755
--- a/quartz/bootstrap-cli.mjs
+++ b/quartz/bootstrap-cli.mjs
@@ -121,10 +121,8 @@
 }
 
 function gitPull(origin, branch) {
-  spawnSync("git", ["fetch", origin, branch], { stdio: "inherit" })
-  spawnSync("git", ["checkout", `${origin}/${branch}`, "--", ":(exclude)content"], {
-    stdio: "inherit",
-  }).error
+  const flags = ["-s", "recursive", "-X", "ours"]
+  spawnSync("git", ["pull", ...flags, origin, branch], { stdio: "inherit" })
 }
 
 yargs(hideBin(process.argv))
@@ -280,7 +278,7 @@
     await popContentFolder(contentFolder)
     if (argv.push) {
       console.log("Pushing your changes")
-      spawnSync("git", ["push", ORIGIN_NAME, QUARTZ_SOURCE_BRANCH], { stdio: "inherit" })
+      spawnSync("git", ["push", "-f", ORIGIN_NAME, QUARTZ_SOURCE_BRANCH], { stdio: "inherit" })
     }
 
     console.log(chalk.green("Done!"))

--
Gitblit v1.10.0