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?

  • Splitting each commit by file?
  • fatal: Interactive git shell is not enabled. got the message fatal: Interactive git shell is not enabled
  • Switch between Git and TFS source control in visual studio
  • Push rejected to Heroku due to sqlite3
  • CFURLCopyResourcePropertyForKey error when gitk
  • Git 1.7.11 Debian fatal: Unable to find remote helper for 'https'
  • Doesn’t work:

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

  • How can I move the entire git repository somewhere else?
  • How to use GitHub V3 API to get commit count for a repo?
  • Why the combination of Maven with Git?
  • Why doesn't my bash prompt update?
  • How to apply a patch using git without configuration
  • How can I sign each (even old) commit in the repository?
  • 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.