百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

delta

> 开发工具
开源

Delta 是一款在 Go 中实现的命令行差异比较工具。

194 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Delta 是一款在 Go 中实现的命令行差异比较工具。

Delta

Delta is both a Go library and a command-line utility for text diffs. Diffs can be displayed in the browser, or in command-line using the --cli flag.

Installation

bash
brew install octavore/tools/delta

Description

Delta implements two diff functions: Smith-Waterman, and histogram diff.

Smith-Waterman is a dynamic programming algorithm for aligning two sequences, in this case text sequences. It originates from bioinformatics, where it is used for aligning DNA sequences.

histogram diff is a diff algorithm first implemented in JGit and subsequently ported over to git, where it can be used with the git diff --histogram command. This implementation post processes the histogram diff in order to push down match regions as far as possible. git also post processes diffs.

Other Usage

delta --cli           # print text diff to stdout
delta --cli --html    # print html diff to stdout
delta --gist          # upload html diff to a gist

Configure Git

The delta binary must be on your $PATH in order for this work. The following are helpers for adding delta to your ~/.gitconfig file.

delta --install   # makes delta the default for `git difftool`
delta --uninstall # remove delta from your gitconfig

User Config

You can configure delta using a ~/.deltarc file, for example:

{
  "context": 9,
  "showEmpty": true,
  "shouldCollapse": false,
  "highlight": true,
  "unmodifiedOpacity": 0.8,
  "diffFontSize": 12
}

Options

config key key type description
context integer between 0 and 4 number of lines of context to show
showEmpty bool whether to hide empty lines
shouldCollapse bool whether to merge browser tabs
highlight bool toggles syntax highlighting
unmodifiedOpacity float opacity of unmodified lines, between 0.1 and 1
diffFontSize integer font size of the diff

Browser Support

Delta works best in Chrome and Safari. You will see a separate tab open for each diff file, and then the tabs will consolidate into a single tab. In Firefox, each diff will remain in separate tabs. This is because in Firefox, each file receives its own IndexedDB instance, instead of a shared instance.

Browser support relies on the following open source libraries:

  • Mithril
  • highlight.js
  • Mousetrap
  • PouchDB

Development

Compiling From Source

go get github.com/octavore/delta/delta

If $GOPATH/bin is on your $PATH, run delta -h for usage.

Regenerating Assets

You will need npm to install the necessary node packages for compiling the front-end assets.

go-bindata is used to generate the bindata.go, which allows us to embed static resources into the compiled binary.

TODO

  • make differ/histogram diff functions more consistent and add an interface.
  • more comments for godoc/golint.
  • fix race condition in update
  • favicon
  • make sidebar resizable

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Goclidevtoolsdiffgolang

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类开发工具
定价开源

> 相关工具

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具