420 字
2 分钟
命令速查
一、日常改完 → 推送(最常用)
# 本地校验(改过代码/配置建议跑;只改文章也建议跑一次 build)pnpm exec astro checkpnpm build
# 提交git add -Agit commit -m "post: 新增文章 xxx" # 或 feat: / fix: / docs: / chore:
# 推送git push origin main推送后 GitHub Actions 会自动构建并发布;Cloudflare(如果已连仓库)也会自动构建 *.pages.dev。
二、只改文章内容时
文章在 src/content/posts/,新建一篇:
pnpm new-post my-post-name# 编辑 src/content/posts/my-post-name.mdpnpm buildgit add -Agit commit -m "post: my-post-name"git push origin main三、更新追番数据(需要走代理时)
NODE_USE_ENV_PROXY=1 HTTPS_PROXY=http://127.0.0.1:2080 node scripts/anime/sync.mjs --provider bangumi
# 确认 src/data/anime-snapshots/bangumi.json 有变化后git add src/data/anime-snapshots/bangumi.jsongit commit -m "chore: sync bangumi snapshot"git push origin main说明:快照文件现在已提交进仓库,Cloudflare 和 GitHub Pages 构建时都会读它;本地 sync 后记得把 json 一起提交。
四、常见情况
push 被拒(远端有新提交)
git pull --rebase origin maingit push origin maingit status 突然冒出一大堆没动过的文件
多半是 Windows 换行(CRLF)差异。先看真实改动再决定:
git diff -w --stat # 忽略空白后的真实改动git diff --ignore-cr-at-eol --name-only确认是纯换行的话,可以 git checkout -- <那些文件> 还原,别直接 git add -A 把噪声提交进去。
只想本地预览,不发布
pnpm dev # http://localhost:4321Cloudflare 没更新
去 CF 项目 → Deployments,看最新一次是不是对应刚推的 commit;没有就点 Retry,或者推一个空提交:
git commit --allow-empty -m "chore: trigger deploy"git push origin main五、整合命令
cd /d/Shirone && pnpm build && git add -A && git commit -m "chore: update site" && git push origin main把 chore: update site 换成实际做的事就行。
分享文章
生成精美分享图或复制链接,与更多人分享本文。
继续阅读
最后更新于 ,距今已过 0 天
部分内容可能已过时