文章历史与回退

文章历史与回退

M-Doc 为每篇文章维护完整的版本历史,支持查看、对比和回退。


提交历史

每次发布文章都会生成一个版本快照,包含:

字段 说明 示例
commit_hash 40 字符 SHA1 哈希 abc1234567890...
short_hash 7 字符短哈希 abc1234
commit_message 提交说明 更新安装步骤
parent_commit_hash 父版本哈希 def7890123456...
created_by 发布者 用户 ID
created_at 发布时间 2026-04-10

查看历史

  1. 打开文章详情页
  2. 点击「历史记录」标签
  3. 查看所有版本快照列表

每条记录显示短哈希、提交说明、作者和时间。

版本回退(Revert)

当发现文章内容有误时,可以回退到之前的版本:

  1. 在历史记录中找到目标版本
  2. 点击「回退到此版本」
  3. 确认操作

回退会创建一个新的版本快照(不删除历史),回退后仍然可以再次回退或继续编辑。

回退操作会触发 article.reverted 事件,自动更新向量索引等。

与 Git 的类比

Git M-Doc
git commit 发布文章
git log 查看历史记录
git revert 回退到指定版本
git diff 版本对比
commit hash commit_hash
commit message commit_message