How to get diff working like git-diff?

前端 未结 14 2233
慢半拍i
慢半拍i 2020-12-12 10:42

I like the output formatting of git diff. The color and the +/- representation of changes between lines is easier to read than GNU di

14条回答
  •  独厮守ぢ
    2020-12-12 11:00

    Since bat has nice colorizing, I've tested if that works with diff too and surprisingly it worked really well out of the box.

    $ diff file1 file2 | bat or $ diff -u file1 file2 | bat

    So I suppose you could make a function like this below to be more efficient:

    function bdiff () { diff -u $@ | bat;}
    

提交回复
热议问题