git - knife:填补 Git 提交元数据编辑空白,简洁 GUI 实现多字段安全批量编辑

📅 2026/8/12 14:23:06
git - knife:填补 Git 提交元数据编辑空白,简洁 GUI 实现多字段安全批量编辑
导航菜单[](/)[登录](/login?return_tohttps%3A%2F%2Fgithub.com%2FTheRealYT%2Fgit - knife)外观设置平台- **AI 代码创作**- [GitHub Copilot借助 AI 编写更优质代码](https://github.com/features/copilot)- [GitHub Copilot 应用从问题到合并的直接代理](https://github.com/features/ai/github - app)- [MCP 注册表集成外部工具](https://github.com/mcp)- **开发者工作流**- [Actions自动化任何工作流](https://github.com/features/actions)- [Codespaces即时开发环境](https://github.com/features/codespaces)- [Issues规划和跟踪工作](https://github.com/features/issues)- [代码审查管理代码变更](https://github.com/features/code - review)- [代码质量在合并时强制执行质量标准](https://github.com/features/code - quality)- **应用程序安全**- [GitHub 高级安全发现并修复漏洞](https://github.com/security/advanced - security)- [代码安全在构建过程中保障代码安全](https://github.com/security/advanced - security/code - security)- [密钥保护防患于未然阻止信息泄露](https://github.com/security/advanced - security/secret - protection)- **探索**- [为何选择 GitHub](https://github.com/why - github)- [文档](https://docs.github.com)- [博客](https://github.blog)- [更新日志](https://github.blog/changelog)- [市场](https://github.com/marketplace)[查看所有功能](https://github.com/features)解决方案- **按公司规模划分**- [企业版](https://github.com/enterprise)- [中小型团队版](https://github.com/team)- [初创企业版](https://github.com/enterprise/startups)- [非营利组织版](https://github.com/solutions/industry/nonprofits)- **按用例划分**- [应用现代化](https://github.com/solutions/use - case/app - modernization)- [DevSecOps](https://github.com/solutions/use - case/devsecops)- [DevOps](https://github.com/solutions/use - case/devops)- [CI/CD](https://github.com/solutions/use - case/ci - cd)- [查看所有用例](https://github.com/solutions/use - case)- **按行业划分**- [医疗保健](https://github.com/solutions/industry/healthcare)- [金融服务](https://github.com/solutions/industry/financial - services)- [制造业](https://github.com/solutions/industry/manufacturing)- [政府机构](https://github.com/solutions/industry/government)- [查看所有行业](https://github.com/solutions/industry)[查看所有解决方案](https://github.com/solutions)资源- **按主题探索**- [AI](https://github.com/resources/articles?topicai)- [软件开发](https://github.com/resources/articles?topicsoftware - development)- [DevOps](https://github.com/resources/articles?topicdevops)- [安全](https://github.com/resources/articles?topicsecurity)- [查看所有主题](https://github.com/resources/articles)- **按类型探索**- [客户案例](https://github.com/customer - stories)- [活动与网络研讨会](https://github.com/resources/events)- [电子书与报告](https://github.com/resources/whitepapers)- [商业洞察](https://github.com/solutions/executive - insights)- [GitHub 技能](https://skills.github.com)- **支持与服务**- [文档](https://docs.github.com)- [客户支持](https://support.github.com)- [社区论坛](https://github.com/orgs/community/discussions)- [信任中心](https://github.com/trust - center)- [合作伙伴](https://github.com/partners)[查看所有资源](https://github.com/resources)开源- **社区**- [GitHub 赞助资助开源开发者](https://github.com/open - source/sponsors)- **项目**- [安全实验室](https://securitylab.github.com)- [维护者社区](https://maintainers.github.com)- [加速器](https://github.com/open - source/accelerator)- [GitHub 明星项目](https://stars.github.com)- [存档项目](https://archiveprogram.github.com)- **仓库**- [主题](https://github.com/topics)- [热门趋势](https://github.com/trending)- [集合](https://github.com/collections)企业版- **企业解决方案**- [企业平台由 AI 驱动的开发者平台](https://github.com/enterprise)- **可用附加组件**- [GitHub 高级安全企业级安全功能](https://github.com/security/advanced - security)- [Copilot for Business企业级 AI 功能](https://github.com/features/copilot/copilot - business)- [高级支持企业级 24/7 支持](https://github.com/enterprise/premium - support)[定价](https://github.com/pricing)按 / 进行搜索[登录](/login?return_tohttps%3A%2F%2Fgithub.com%2FTheRealYT%2Fgit - knife)[注册](/signup?ref_ctaSignupref_locheaderloggedoutref_page%2F%3Cuser - name%3E%2F%3Crepo - name%3Esourceheader - reposource_repoTheRealYT%2Fgit - knife)外观设置你已在其他标签页或窗口登录。[重新加载]() 以刷新会话。你已在其他标签页或窗口退出登录。[重新加载]() 以刷新会话。你已在其他标签页或窗口切换账户。[重新加载]() 以刷新会话。关闭提醒{{ message }}[ TheRealYT ](/TheRealYT) / **[git - knife](/TheRealYT/git - knife) ** 公开- [ 通知 ](/login?return_to%2FTheRealYT%2Fgit - knife) 你必须登录才能更改通知设置- [ 分叉 3 ](/login?return_to%2FTheRealYT%2Fgit - knife)- [ 加星 151 ](/login?return_to%2FTheRealYT%2Fgit - knife)- [ 代码 ](/TheRealYT/git - knife)- [ 问题 0 ](/TheRealYT/git - knife/issues)- [ 拉取请求 0 ](/TheRealYT/git - knife/pulls)- [ 操作 ](/TheRealYT/git - knife/actions)- [ 项目 ](/TheRealYT/git - knife/projects)- [ 安全与质量 0 ](/TheRealYT/git - knife/security)- [ 洞察 ](/TheRealYT/git - knife/pulse)其他导航选项- [ 代码 ](/TheRealYT/git - knife)- [ 问题 ](/TheRealYT/git - knife/issues)- [ 拉取请求 ](/TheRealYT/git - knife/pulls)- [ 操作 ](/TheRealYT/git - knife/actions)- [ 项目 ](/TheRealYT/git - knife/projects)- [ 安全与质量 ](/TheRealYT/git - knife/security)- [ 洞察 ](/TheRealYT/git - knife/pulse)[](/TheRealYT/git - knife)主分支[分支](/TheRealYT/git - knife/branches)[标签](/TheRealYT/git - knife/tags)[](/TheRealYT/git - knife/branches)[](/TheRealYT/git - knife/tags)前往文件代码打开更多操作菜单文件夹和文件| 名称 | 名称 | 最后提交消息 | 最后提交日期 || --- | --- | --- | --- |最新提交历史记录[23 次提交](/TheRealYT/git - knife/commits/main/)[](/TheRealYT/git - knife/commits/main/)23 次提交[.github/workflows](/TheRealYT/git - knife/tree/main/.github/workflows 此路径跳过空目录)|[.github/workflows](/TheRealYT/git - knife/tree/main/.github/workflows 此路径跳过空目录)||[docs](/TheRealYT/git - knife/tree/main/docs docs)|[docs](/TheRealYT/git - knife/tree/main/docs docs)||[src - tauri](/TheRealYT/git - knife/tree/main/src - tauri src - tauri)|[src - tauri](/TheRealYT/git - knife/tree/main/src - tauri src - tauri)||[src](/TheRealYT/git - knife/tree/main/src src)|[src](/TheRealYT/git - knife/tree/main/src src)||[.gitignore](/TheRealYT/git - knife/blob/main/.gitignore .gitignore)|[.gitignore](/TheRealYT/git - knife/blob/main/.gitignore .gitignore)||[README.md](/TheRealYT/git - knife/blob/main/README.md README.md)|[README.md](/TheRealYT/git - knife/blob/main/README.md README.md)||[index.html](/TheRealYT/git - knife/blob/main/index.html index.html)|[index.html](/TheRealYT/git - knife/blob/main/index.html index.html)||[package.json](/TheRealYT/git - knife/blob/main/package.json package.json)|[package.json](/TheRealYT/git - knife/blob/main/package.json package.json)||[pnpm - lock.yaml](/TheRealYT/git - knife/blob/main/pnpm - lock.yaml pnpm - lock.yaml)|[pnpm - lock.yaml](/TheRealYT/git - knife/blob/main/pnpm - lock.yaml pnpm - lock.yaml)||[tsconfig.json](/TheRealYT/git - knife/blob/main/tsconfig.json tsconfig.json)|[tsconfig.json](/TheRealYT/git - knife/blob/main/tsconfig.json tsconfig.json)||[tsconfig.node.json](/TheRealYT/git - knife/blob/main/tsconfig.node.json tsconfig.node.json)|[tsconfig.node.json](/TheRealYT/git - knife/blob/main/tsconfig.node.json tsconfig.node.json)||[vite.config.ts](/TheRealYT/git - knife/blob/main/vite.config.ts vite.config.ts)|[vite.config.ts](/TheRealYT/git - knife/blob/main/vite.config.ts vite.config.ts)|[查看所有文件]仓库文件导航- **README**- 更多项目git - knife 精准塑造你的 Git 提交历史 — 像编辑表格一样修改每次提交的消息、作者和日期。[![git - knife 截图](/TheRealYT/git - knife/raw/main/docs/screenshot.png)](/TheRealYT/git - knife/blob/main/docs/screenshot.png)一款简洁的桌面 GUI 工具可直接编辑 Git 提交元数据包括 **提交消息、作者日期、提交者日期、作者姓名和邮箱** 。现有的 GUI 工具如 GitKraken、Sublime Merge、Fork、lazygit在修改提交消息和调整提交顺序方面表现出色但通常将提交 **日期** 视为不可变的并且不会暴露任意提交的提交者日期或作者身份信息。而那些能够重写这些元数据的工具如 git - filter - repo、git rebase 环境技巧、git commit - tree则没有 GUI 界面。git - knife 正好填补了这一空白。它不会重新实现 Git 的功能而是通过调用系统的 git 命令行工具并使用 git commit - tree 来重建提交同时复用每个提交的原始树结构从而 **确保文件内容不会被更改** 。功能对比| 工具 | 简洁 GUI | 修改消息 | 重新排序/合并/删除 | 编辑 **作者日期** | 编辑 **提交者日期** | 编辑作者/邮箱 | 批量查找和替换正则表达式 || --- | --- | --- | --- | --- | --- | --- | --- || **git - knife** | ✅ | ✅ | 计划中 | ✅ | ✅ | ✅ | ✅ || GitKraken | ✅ | ✅ | ✅ | ⚠️ 仅可修改 | ❌ | ⚠️ | ❌ || Sublime Merge | ✅ | ✅ | ✅ | ❌ | ❌ | ⚠️ 仅可修改 | ❌ || Fork | ✅ | ✅ | ✅ | ❌ | ❌ | ⚠️ | ❌ || SmartGit | ✅ | ✅ | ✅ | ⚠️ | ❌ | ✅ | ❌ || git - cola | ◐ | ✅ | ✅ | ✅ | ❌ | ✅ | ❌ || lazygit (TUI) | ◐ TUI | ✅ | ✅ | ❌ | ❌ | ⚠️ | ❌ || git - filter - repo (CLI) | ❌ | ✅ | 通过回调函数 | ✅ | ✅ | ✅ | ✅ |图例✅ 一流支持 · ⚠️ 可行但操作不便或功能受限 · ◐ 界面陈旧或为终端界面 · ❌ 不支持 · 计划中。那些精美的 GUI 工具在修改消息和调整顺序方面表现良好但通常将提交 **日期** 尤其是提交者日期视为不可变的并且没有提供对作者身份信息进行批量正则替换的功能。而那些能够重写这些元数据的工具则缺乏 GUI 界面。git - knife 则结合了两者的优点一个简洁的 GUI 界面可安全地批量编辑所有字段。状态MVP- ✅ 打开仓库列出当前分支的提交记录- ✅ 编辑提交消息、作者姓名和邮箱、作者日期、提交者日期、提交者姓名和邮箱- ✅ 对这些文本字段进行批量查找和替换支持 literal 或正则表达式非常适合在所有地方修正错误的邮箱- ✅ 在应用更改之前预览所有更改- ✅ 每次重写前自动备份引用并支持一键恢复- ✅ 当重写会影响已推送的历史记录时发出警告- ✅ 合并提交被锁定此版本中不可编辑- ⛔ 尚未支持重新排序/合并/删除、合并重写、暂存区/分支/远程仓库要求- **git** (2.x)- **Node.js** **pnpm** (corepack enable pnpm 或 npm i - g pnpm)- **Rust** (稳定版) — 通过 安装- Linux 系统上 Tauri v2 的依赖webkit2gtk - 4.1、libgtk - 3、libayatana - appindicator3、librsvg2Debian/Ubuntusudo apt install libwebkit2gtk - 4.1 - dev build - essential curl wget file libxdo - dev libssl - dev libayatana - appindicator3 - dev librsvg2 - dev运行开发模式pnpm installpnpm tauri dev首次 cargo 构建会下载并编译 Tauri 依赖项可能需要几分钟。构建打包pnpm tauri build 打包 (tauri build) 需要应用图标。图标已提交到 src - tauri/icons/ 目录下可以使用 pnpm tauri icon path/to/icon.png 从任何正方形 PNG 图像重新生成图标。开发运行时不需要图标。自动发布GitHub Actions.github/workflows/release.yml 使用 [tauri - action](https://github.com/tauri - apps/tauri - action) 为 **macOS、Linux 和 Windows** 构建原生安装程序并将其附加到 GitHub 草稿版本中。通过推送标签来发布版本git tag v0.1.0git push origin v0.1.0也可以从仓库的 **Actions** 标签页手动触发。目前尚未设置代码签名因此 macOS/Windows 构建版本是未签名的适合早期测试人员使用。编辑历史记录并推送编辑提交1. **打开** 一个仓库浏览... 或粘贴路径。2. 点击任何 **非合并** 提交以展开编辑器。3. 修改提交消息、作者/提交者姓名、邮箱或日期。编辑过的行将高亮显示日期字段将保留提交的原始 UTC 偏移量。4. 点击 **查看并应用** 检查旧 → 新的预览然后确认。git - knife 仅会重写 **本地分支** 。它不会与远程仓库进行交互也不会自动为你推送更改 — 推送操作始终需要你手动执行。批量查找和替换点击提交表格上方的 **批量查找和替换** 可以一次性更改多个提交中的文本- 选择要修改的字段提交消息、作者/提交者姓名、作者/提交者邮箱 — 任意组合。- 输入 **查找** / **替换** 内容。切换 **正则表达式** 以使用 $1 反向引用进行模式匹配或者关闭该选项进行字面搜索。默认情况下搜索是区分大小写的。- 面板会实时统计匹配的提交和替换次数。点击 **暂存编辑** 将更改标记为高亮行然后像往常一样点击 **查看并应用** 。示例 — 将所有提交的旧邮箱更改为新邮箱选择 _作者邮箱_ _提交者邮箱_查找 oldexample.com替换为 newexample.com。合并提交将被跳过并且可以连续进行多次替换操作。推送重写后的提交编辑提交会更改其哈希值 **以及后续所有提交的哈希值** 因此本地分支和远程分支会出现差异。普通的 git push 会被拒绝提示 _非快进式更新_。可以使用 --force - with - lease 选项进行推送git push --force - with - lease origin 分支名--force - with - lease 会在远程分支自上次拉取后发生变化时拒绝推送从而避免意外覆盖队友的提交。建议优先使用该选项而不是普通的 --force因为后者会跳过安全检查。 当你的编辑涉及到上游已经存在的提交时git - knife 会显示 **重写已推送历史记录** 警告。如果可能的话尽量只编辑未推送的提交 — 重写共享历史记录会迫使其他开发者重新同步。重写共享历史记录后已经拉取了旧提交的开发者现在会有不同的历史记录。他们需要将本地分支重新同步到新的远程状态git fetch origingit reset --hard origin/分支名 # 丢弃本地独有的提交 — 请先进行协调撤销重写- **在应用内****备份** 面板可以一键恢复重写前的分支指针。- **从命令行**每次应用更改时都会保存一个备份引用 —git for - each - ref refs/knife - backup # 查找重写前的分支指针git reset --hard 备份引用或哈希值 # 将分支指针移回git reflog 也会记录旧的分支指针。如果你已经强制推送了更改可以先在本地恢复然后再次使用 git push --force - with - lease 推送。签名说明透明默认情况下git - knife 会在每个重写的提交末尾附加一个小的、**公开的** 说明该说明存储在单独的注释引用中不会影响你的常规注释git notes --refgit - knife show 提交哈希值 # 查看说明git for - each - ref refs/notes/git - knife # 检查该仓库是否被 git - knife 编辑过该说明在普通的 git log 中不可见存储在单独的引用中但可以完全被发现 — 没有隐藏编码。你可以随时在应用中通过 ** 签名说明** 复选框关闭该功能设置会被记住。要完全从仓库中移除该说明可以使用以下命令git update - ref - d refs/notes/git - knife工作原理- src - tauri/src/git.rs — 唯一调用 git 命令的地方。- commits.rs — open_repo、list_commits使用 NUL/记录分隔符解析。- rewrite.rs — preview_edits apply_edits通过 commit - tree 从最早编辑的提交开始重建提交链直到分支末尾然后保存备份引用并使用比较和交换操作移动分支指针。- backup.rs — 列出 refs/knife - backup/* 并通过 git reset --hard 恢复。重写策略在 Git 层面通过 scratchpad/verify_engine.sh 进行验证重现精确的 commit - tree 流程并确保内容差异为空。安全性每次应用更改时都会创建一个指向旧分支末尾的 refs/knife - backup/分支名/时间戳 引用在进行任何更改之前进行备份。没有数据会被强制删除你可以随时从 **备份** 面板恢复。关于未提供描述、网站或主题信息。资源- [README](README.md)- [活动](/TheRealYT/git - knife/activity)星标**151** 个星标关注者**1** 个关注者分叉[ **3** 个分叉](/TheRealYT/git - knife/forks)[举报仓库](/contact/report - content?content_urlhttps%3A%2F%2Fgithub.com%2FTheRealYT%2Fgit - knifereportTheRealYT%28user%29)版本发布软件包贡献者使用的语言页脚[ ](https://github.com) (C) 2026 GitHub, Inc.页脚导航- [条款](https://docs.github.com/site - policy/github - terms/github - terms - of - service)- [隐私](https://docs.github.com/site - policy/privacy - policies/github - privacy - statement)- [安全](https://github.com/security)- [状态](https://www.githubstatus.com/)- [社区](https://github.community/)- [文档](https://docs.github.com/)- [联系我们](https://support.github.com?tagsdotcom - footer)- 管理 Cookie- 不共享我的个人信息此时你无法执行该操作。