I'm using less as my Git pager.
If the git diff
output is readable on one page, my Git prints the output to the screen.
Sometimes I'm too fast with typing Ctrl + D (half page down), which kills my terminal. Is there an option to enable the pager for git diff
, even if the output is very small?
This doesn't work:
git -p diff
git --paginate diff
git
settings: pager.diff = true
Git uses pager when you run git diff , git show , git grep etc. If you want to see the result without pager, just add --no-pager or -P .
When you run Git commands that produce a bunch of output, Git will use a pager to present the content starting at the beginning, rather than spitting it all out to the screen at once. This will almost always come in handy for commands like git-diff and git-log . By default, Git uses less as its pager.
answered Jul 18, 2019 by debashis borgohain (27.5k points) --no-pager to git will tell it to not use a pager. Passing the option -F to less will tell it to not page if the output fits in a single screen. Usage: git --no-pager diff.
^M represents carriage return. This diff means something removed a Unicode BOM from the beginning of the line and added a CR at the end.
This is controlled by the -F
(--quit-if-one-screen
) option to less.
Git uses the options FRSX
for/of less by default, if none are specified by the $LESS
or $GIT_PAGER
environment variables. To change it, specify the core.pager
option and set it to RSX
:
git config --global core.pager 'less -+F'
Older versions of Git used to recommend the following in their documentation:
git config --global core.pager 'less -+$LESS -RSX'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With