docs: 记录中文 commit message 乱码修复经验(提交历史重写为 2c90205/4b3ea03/b11bea1)

This commit is contained in:
2026-08-23 11:39:23 +08:00
parent b11bea1962
commit 8df2f002d2
4 changed files with 12 additions and 1 deletions
+1
View File
@@ -12,6 +12,7 @@
- 依赖固定 `electron-vite@5 vite@7 @vitejs/plugin-react@5`(避免 vite8 与 electron-vite peer 冲突);Electron ^43。
- 命令:`npm run dev` / `npm run build` / `npm start`preview/ `npm run typecheck`
- **中文路径 PowerShell 坑**:参数含中文路径(`c:/Users/范先生/...`)会乱码导致 cd 失败,命令一律用相对路径。
- **⚠️ 中文 commit message 坑(2026-08-23 修复)**`git commit -m "中文"` 在 PowerShell/cmd 下会按 GBK 传参、git 按 UTF-8 存储 → **提交信息双编码乱码**。已用 Node 脚本 + `git hash-object` 保真重写 3 条历史并 force push(新 hash2c90205/4b3ea03/b11bea1)。**以后提交一律用 `git commit -F <utf8消息文件>`**write_to_file 写 UTF-8 文件再 -F),或提交信息用英文。
- 后台启动 dev`cd SmartAgriCenter; Start-Process npm.cmd -ArgumentList 'run','dev' -RedirectStandardOutput 'dev.log' -RedirectStandardError 'dev-err.log'`(必须 npm.cmd)。
- Electron 二进制缺失时:先 `$env:ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"``node node_modules/electron/install.js`
- dev.log / dev-err.log 留在 SmartAgriCenter 根目录,受 SafeDelete 保护,无害。