How to improve git's diff highlighting?

后端 未结 3 602
时光说笑
时光说笑 2020-12-14 20:59

The output of git diff is optimized for code which tends to be one statement per line whereas text can (if authors like me are too lazy to use line breaks) caus

3条回答
  •  猫巷女王i
    2020-12-14 21:11

    Also worth mentioning is diffr. It's written in Rust and uses Myers longest common subsequence algorithm. Compared to git's diff-highlight it gives better results, see:

    git's diff-highlight:

    diffr:

    Once installed, making use of it is similar to that of diff-highlight, i.e. edit ~/.gitconfig, and add to the [pager] section following:

    [pager]
        log  = diffr | less
        show = diffr | less
        diff = diffr | less
    

提交回复
热议问题