Can I scroll to new lines using mouse wheel inside git diff?
I'm using Ubuntu 16.04 default terminal (it's GNOME I believe?)
The problem I'm facing is that when I use git diff
command to inspect my local changes I can scroll up/down using the mouse wheel, but no new lines are showing up when I get to the bottom (so I can see only one page of changes). In order to go to the next lines I can use space or up/down arrows of the keyboard, but can I somehow make this with the mouse wheel?
BTW If I use the less
command it works as expected -> scrolling down goes to new lines.
Thanks to @edwinksl's answer I managed to find a solution to the problem.
So by default git uses LESS
as a pager and I believe the default arguments are FRSX
.
On git 1.8+ you can remove options with less -+<option>
, in my case I need to remove the X
option so:
git config --global --replace-all core.pager 'less -+X'
but as @pcworld mention this can cause problems with diffs that fit on a single page, thus:
git config --global --replace-all core.pager 'less -+FX'
fixed the scrolling issue for me.
From https://stackoverflow.com/a/2183920/486919, one way to do this and preserve the diff highlighting is to use git diff
without a pager:
git --no-pager diff