How to make git diff write to stdout?

后端 未结 3 1981
既然无缘
既然无缘 2021-01-29 20:48

By default git diff prints all +- lines to the stdout however I have a (devian) machine (which I connect through ssh) where git diff leads

3条回答
  •  [愿得一人]
    2021-01-29 21:27

    The following core.pager value uses less, which prints to stdout, and also has pager functionality (if required), enabling scrolling up and down (unlike cat):

    $ git config --global core.pager "less -FRSX"
    

    It immediately quits if the diff fits on the first screen (-F), outputs raw control characters (-R), chops long lines rather than wrapping (-S), and does not use termcap init/deinit strings (-X).

提交回复
热议问题