Always use the pager for git diff

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?

Doesn’t work:

  • git -p diff
  • git --paginate diff
  • git settings: pager.diff = true

  • Git diff without the pluses and minuses
  • Git partial push and partial pull, to a file
  • Removal of CR in Git repository not showing up in the git diff or git status
  • Git diff between two tags with username
  • Running git diff-tree with --numstat and --name-status
  • Why Git diff of 2 versions of a single file is empty?
  • Git diff of branches or commits showing file list overview in visual difftool and then selectable single file diff
  • Git - get a list of files that are identical between two revisions
  • One Solution collect form web for “Always use the pager for git diff”

    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'
    Git Baby is a git and github fan, let's start git clone.