insight Simon Willison 2026-09-14T00:28 正文 ok 120 words

commit-rewriter 0.1 发布

英文标题:commit-rewriter 0.1

commit-rewriter 0.1 是一款用于批量编辑 Git 仓库提交信息的轻量级 Web 应用。作者最初开发它,是为了清理 Datasette 安全版本提交记录中编码 Agent 遗留内容及私有仓库 Issue ID 等不适合公开的信息。开发者可通过 `uvx commit-rewriter path/to/repo` 启动工具;提交修改后,工具会先创建带时间戳的备份分支,再从首次编辑的提交开始重写后续全部提交历史。
打开原文相关 7.2 · 机会 1
media34.6 KB

中文

我前几天开发了这个小型 Web 应用,用于协助编辑 Datasette 安全版本发布的提交信息。最初的提交中充满了编码 Agent 遗留的杂乱内容,以及来自我们私有仓库的 Issue ID 引用,因此不适合公开发布。

如果你想编辑某个仓库的提交信息,可以这样运行它:

uvx commit-rewriter path/to/repo

如果你已经位于该仓库目录中,则无需提供路径。

commit-rewriter Web 界面截图。页面顶部显示“commit-rewriter”标题,其下方为仓库路径、当前分支和提交哈希,以及工具的简短说明。工具栏展示待处理编辑数量,并提供“Discard drafts”和“Rewrite commit messages”按钮;后面还有用于按提交信息、作者或哈希搜索的搜索框,以及“Edited only”复选框。左侧边栏标题为“Navigate commits”,列出近期提交信息及其短哈希。主面板为每个提交显示一张卡片,包含哈希、作者和时间戳,以及内含可编辑提交信息的文本区域和“View full formatted diff”切换项。

提交编辑内容后,该工具会针对当前仓库状态创建一个带时间戳的分支,以便在需要时回退;随后,它会从你首次编辑的提交开始,一直重写到最新提交为止的所有提交。

English / 原文

I built this little web app the other day to help edit the commit messages for the Datasette security releases. The initial commits were full of coding agent cruft and references to issue IDs from our private repository, so they weren't fit for publication.

If you want to edit the commit messages for a repository you can run it like this:

uvx commit-rewriter path/to/repo

Omit the path if you are already in the directory for that repo.

Screenshot of the commit-rewriter web interface. A heading reads commit-rewriter above the repository path and current branch and commit hash, with a short description of the tool. A toolbar shows a pending edits count with Discard drafts and Rewrite commit messages buttons, followed by a search box for message, author, or hash and an Edited only checkbox. A left sidebar titled Navigate commits lists recent commit messages with their short hashes. The main panel shows a card for each commit with its hash, author and timestamp, an editable text area containing the commit message, and a View full formatted diff toggle.

When you submit your edits the tool creates a timestamped branch of your current repo state - to allow you to revert if you need to - and then rewrites every commit from the first one you edited to the most recent.