Skip to content
Tutorials Center
My learning

Topics

Git Reference ยท Configuration Options

core.pager setting

Reference for core.pager: how Git pipes long output through a pager, how to switch it off or change it, and how pager.<command> and --no-pager behave.

When the output of a command such as git log, git diff or git branch is longer than a screen and goes to a terminal, Git starts a pager and pipes the output through it, so you can scroll. core.pager chooses that program. If it is not set, Git uses $PAGER, and finally less.

Paging happens only when standard output is a terminal. In scripts, pipes and redirections Git prints directly, which is why most examples on a server look unpaged.

Terminal
git config --global core.pager "less -FRX"   # quit if one screen, keep colors, no clear
git config --global core.pager cat           # never really page
git --no-pager log                           # one-off: skip the pager

Try it

Git only starts a pager when standard output is a terminal, and these examples run without one. The helper tty below uses the script utility to give a command a pseudo-terminal, so you can watch the pager work.

Bash Choosing and bypassing the pager

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Bash Pager per command

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.

Syntax

Terminal
git config [--global] core.pager <command>
git config [--global] pager.<command> <bool | command>
git [--paginate | -p | --no-pager | -P] <command>
Name Description
core.pager Command line that receives the output. Empty or cat effectively disables paging.
pager.<command> Per-command override: false never pages, true always uses the default pager, or a command line for that subcommand.
-p, --paginate Use the pager even for commands that normally do not page, and override pager.<command>; still only when output is a terminal.
-P, --no-pager Never use the pager for this run.
GIT_PAGER Environment variable that beats core.pager; PAGER is the fallback.

Precedence: GIT_PAGER, then pager.<command>, then core.pager, then PAGER, then less.

Usage notes

  • LESS defaults. If LESS is not set, Git sets it to FRX: quit at once when the output fits one screen, pass raw color escapes, and do not clear the screen on exit. Set LESS yourself to change that, or core.pager with explicit flags.
  • Pager failures are silent: a missing program gives "fatal: unable to run pager" style errors on some commands, so test a custom value with git -p log.
  • Better diffs: point core.pager at a diff viewer such as delta or diff-so-fancy and keep interactive.diffFilter consistent for git add -p.
  • git config, git var and plumbing commands generally do not page; porcelain commands such as log, diff, show, blame, branch and tag -l do.
  • Exit status of Git is not affected by quitting the pager early, though a SIGPIPE may cut a long script output.
  • Scripts: use --no-pager or pipe the output; do not rely on how a user has configured paging.
  • Interactive editors: git help uses a different setting, man.viewer, and help.format.