Hacker News 中文摘要

RSS订阅

显示HN:Deff——终端中的并排Git差异对比工具 -- Show HN: Deff – Side-by-side Git diff review in your terminal

文章摘要

Deff是一个Git差异对比工具,提供交互式并排文件查看功能,支持逐文件导航、水平和垂直滚动、语法高亮,并能标记新增/删除行,方便代码审查。

文章总结

GitHub 项目:deff —— 交互式 Git 差异对比工具

项目简介
deff 是一个基于 Rust 开发的终端用户界面(TUI)工具,专为 Git 差异对比设计。它提供以下核心功能:
- 并排文件对比:支持垂直/水平滚动、语法高亮、增删行着色。
- 交互式导航:按文件跳转、键盘/鼠标操作(支持 Vim 风格快捷键 h/j/k/l)。
- 搜索与标记:文件内搜索(/ + Enter)、标记已审阅文件(r 键持久化记录)。
- 多策略对比:默认基于上游分支差异(upstream-ahead),可选指定提交范围(--base/--head)或包含未提交更改(--include-uncommitted)。

快速开始
bash curl -fsSL https://raw.githubusercontent.com/flamestro/deff/main/install.sh | bash
安装脚本会自动检测 Rust 环境并完成编译。

功能亮点
- 主题适配(--theme dark/light/auto)。
- 本地构建支持(cargo build --release)。
- GitHub 版本自动化(通过发布标签触发版本更新)。

示例场景
```bash

对比工作目录未提交的更改

deff --include-uncommitted

指定提交范围

deff --base origin/main --head HEAD
```

项目状态
- 开源协议:MIT
- 活跃度:198 Stars,7 Forks,3 名主要贡献者。
- 开发语言:Rust(99.1%)+ Shell(0.9%)。

资源链接
- 架构文档
- 贡献指南

(注:省略了 GitHub 页面导航菜单、企业解决方案等无关内容,聚焦工具核心功能与使用场景。)

评论总结

以下是评论内容的总结:

  1. 现有工具推荐

    • 多位用户推荐了现有的diff工具,如icdiff、delta、difftastic和vimdiff。
      • "I have been using icdiff for the longest time to get side by side diffs."(评论1)
      • "git supports specifying an external pager so folks can plug in alternatives (such as delta)"(评论2)
  2. 功能需求

    • 用户希望有更多功能,如支持代码审查注释、三面板视图(类似JetBrains)和更好的冲突处理。
      • "the ability to provide a comment on lines or ranges in a diff to provide targeted feedback"(评论4)
      • "I would like to see three views for handling conflicts... like the Jetbrains IDEs"(评论12)
  3. 性能与易用性

    • 用户关注工具在大文件(如5000行以上)下的性能表现,以及是否易于集成到现有工作流中。
      • "how does it hold up on large files? 5k+ line diffs are where most of these tools either choke"(评论5)
      • "getting users to adopt a new tool with its own incantations is a tough sell"(评论2)
  4. UI改进建议

    • 用户建议改进UI设计,如减少占用空间、优化对齐方式,并增加演示动图或视频。
      • "8 terminal lines are taken by the tool's UI. Could have been 2."(评论18)
      • "You definitely need a gif or apng file showing it's use in the github readme."(评论16)
  5. 安装与安全

    • 有用户对通过curl | bash安装方式的安全性表示担忧。
      • "It blows my mind that nowadays, some random tools on internet tells you to do 'curl -fsSL https://.... | bash'"(评论13)
  6. 其他建议

    • 用户提出了一些具体建议,如支持jj工具、提供binstall支持,以及优化代码块移动的显示。
      • "will this play well with jj?"(评论14)
      • "Any chance of binstall support?"(评论21)