Search code examples
gitbashshellunixgit-diff

How do I find out what options git-diff uses when it invokes 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 was running): ps aux | grep less <= Didn't show me which options it was using.

I'm on Darwin.


Solution

  • 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