Files
soul/开发文档/8、部署/自动同步与分支策略.md
2026-01-09 11:58:08 +08:00

1.1 KiB
Raw Permalink Blame History

自动同步与分支策略Mycontent-book

1. 自动同步做了什么

脚本:external/Mycontent-book/scripts/autosync.sh

  • 监听本地文件变化
  • 有变化就自动提交并推送
  • 没变化也会定时拉取远端更新

2. 自动同步的关键行为

A. 触发型(你改文档)

当检测到变更:

  • git add .
  • git commit -m "chore: auto-sync"
  • git pull --rebase origin 当前分支
  • git push

B. 轮询型(你不改也会拉)

默认每 60 秒拉一次:

  • git pull --rebase origin 当前分支

你可以临时改轮询时间(单位秒):

  • POLL_SECONDS=10 ./scripts/autosync.sh

3. 为什么要有“自动拉取”

因为你这个仓库可能同时被两条链路改:

  • 你本地写作autosync 推)
  • v0/Vercel 或其他电脑(远端先更新)

自动拉取能降低“本地落后导致 push 冲突”的概率。

4. 稀疏检出sparse checkout说明

本地目前只检出了:book/scripts/

如果你后面要改站点代码,需要把对应目录加进来(见 8、部署/本地运行.md)。