How should I use git diff for long lines?

后端 未结 15 2494
庸人自扰
庸人自扰 2020-12-04 05:37

I\'m running git-diff on a file, but the change is at the end of a long line.

If I use cursor keys to move right, it loses colour-coding—and worse the lines do

15条回答
  •  庸人自扰
    2020-12-04 05:44

    Eight years later I find a superior answer, from https://superuser.com/questions/777617/line-wrapping-less-in-os-x-specifically-for-use-with-git-diff:

    git config core.pager `fold -w 80 | less`
    

    Now you pipe the git diff through fold, first, then to less: wrapped, less page-height is correct, keep syntax highlighting.

提交回复
热议问题