开发者

How do I find out what options git-diff uses when it invokes less?

开发者 https://www.devze.com 2022-12-12 02:45 出处:网络
I want to reproduce the pager behavior that git-diff uses but I don\'t know how. Is there a way I could find out what options it uses with less?

I want to reproduce the pager behavior that git-diff uses but I don't know how. Is there a way I could find out what options it uses with less?

I already tried this: strings "$(dirname $(which git-diff))/*" | grep 'less '

And this (while less wa开发者_如何转开发s running): ps aux | grep less <= Didn't show me which options it was using.

I'm on Darwin.


See the git-config man page, specifically the description of core.pager. Also, you could inspect the environment of the pager process

$ tr '\0' '\n' < /proc/5568/environ | grep LESS
LESS=FRSX


A useful technique for doing this sort of thing is to set the GIT_EXTERNAL_DIFF environment variable to a shell script that does nothing but echo its arguments. Then run git diff and look at the output.


Add this to your .bashrc:

export LESS="$LESS -S" # add more options to `less`


See http://www.pixelbeat.org/scripts/idiff for portable ways to control less

0

精彩评论

暂无评论...
验证码 换一张
取 消