在Linux上如何在没有git的情况下像`git diff –word-diff`这样的差异?

本文介绍在没有Git的Linux环境下,如何使用wdiff命令实现类似git diff --word-diff的功能,以及如何结合colordiff增强输出效果。

The result of git by git diff --word-diff is great. But how to do diff like git diff --word-diff without git on Linux? The plain diff command on Linux seems not accept options like --word-diff.

git diff --word-diff产生的git效果很好。 但是如何在Linux上没有git的情况下像git diff --word-diff diff一样git diff --word-diffLinux上的diff命令似乎不接受--word-diff类的选项。

The wdiff is for word-diff:

wdiff用于单词差异:

wdiff program is a front end to diff for comparing files on a word per word basis. A word is anything between whitespace.

wdiff program是diff的前端,用于比较每个单词一个单词的文件 。 单词是空格之间的任何内容。

$ wdiff file1 file2

Bonus: colordiff is a wrapper for ‘diff’. colordiff is written in Perl and produces the same output but with pretty ‘syntax’ highlighting.

奖励: colordiff是'diff'的包装。 colordiff用Perl编写,并产生相同的输出,但突出显示“语法”。

$ wdiff file1 file2 | colordiff

or

要么

$ wdiff file1 file2 | colordiff | less -R
Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。

翻译自: https://www.systutorials.com/how-to-do-diff-like-git-diff-word-diff-without-git-on-linux/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值