突出显示更改的行和每个更改的行中更改的字节 [英] highlight changed lines and changed bytes in each changed line
问题描述
开放源代码项目 Trac 具有出色的差异突出显示器 - 突出显示每个已更改行中已更改的行和已更改的字节
STRONG>!请参阅 https://trac.transmissionbt.com/changeset/12148 或 http://trac.gajim.org/changeset/297ad7711d20bfee1491768640d9bc5384464363 为例。有没有办法使用在bash终端,git或vim 用于差异输出(patch-file)的相同颜色突出显示(即更改行和更改字节)
?我分享了一个可能有帮助的protip,这里是 https://coderwall.com/p/ydluzg
diff-highlight
Perl贡献脚本产生的输出与Trac截图类似很可能Trac正在使用它:
安装时:
wget https://raw.githubusercontent.com/git/git/fd99e2bda0ca6a361ef03c04d6d7fdc7a9c40b78/contrib/diff-highlight/diff-highlight&& chmod + x diff-highlight
移动文件 diff-highlight
到〜/ bin /
目录(或者你的 $ PATH
是),然后添加跟随你的〜/ .gitconfig
:
[pager]
diff = diff-highlight |减去
log = diff-highlight |减去
show = diff-highlight |
@cirosantilli建议的单一粘贴安装:
cd〜/ bin
curl -O https://raw.githubusercontent.com/git/git/fd99e2bda0ca6a361ef03c04d6d7fdc7a9c40b78/contrib/diff-highlight/diff-highlight
chmod + x diff-highlight
git config --global pager.log'diff-highlight | '
git config --global pager.show'diff-highlight |少'
git config --global pager.diff'diff-highlight |减去'
Open Source project Trac has an excellent diff highlighter — it highlight changed lines and changed bytes in each changed line! See https://trac.transmissionbt.com/changeset/12148 or http://trac.gajim.org/changeset/297ad7711d20bfee1491768640d9bc5384464363 for examples.
Is there way to use the same color highlight (i.e. changed lines and changed bytes too) in bash terminal, git or vim for diff output (patch-file)?
I shared a protip that might help, here it is https://coderwall.com/p/ydluzg
The diff-highlight
Perl contrib script produces output so similar to that of the Trac screenshots that it is likely that Trac is using it:
Install with:
wget https://raw.githubusercontent.com/git/git/fd99e2bda0ca6a361ef03c04d6d7fdc7a9c40b78/contrib/diff-highlight/diff-highlight && chmod +x diff-highlight
Move the file diff-highlight
to the ~/bin/
directory (or wherever your $PATH
is), and then add the following to your ~/.gitconfig
:
[pager]
diff = diff-highlight | less
log = diff-highlight | less
show = diff-highlight | less
Single copy paste install suggested by @cirosantilli:
cd ~/bin
curl -O https://raw.githubusercontent.com/git/git/fd99e2bda0ca6a361ef03c04d6d7fdc7a9c40b78/contrib/diff-highlight/diff-highlight
chmod +x diff-highlight
git config --global pager.log 'diff-highlight | less'
git config --global pager.show 'diff-highlight | less'
git config --global pager.diff 'diff-highlight | less'
这篇关于突出显示更改的行和每个更改的行中更改的字节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!