Can I scroll to new lines using mouse wheel inside git diff?
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
On Windows Terminal the answer didn't help me. Instead, I had to do the following:
git config --global --replace-all core.pager 'less --mouse'