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.
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.
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.
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
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
LESSdefaults. IfLESSis not set, Git sets it toFRX: quit at once when the output fits one screen, pass raw color escapes, and do not clear the screen on exit. SetLESSyourself to change that, orcore.pagerwith 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.pagerat a diff viewer such asdeltaordiff-so-fancyand keepinteractive.diffFilterconsistent forgit add -p. git config,git varand plumbing commands generally do not page; porcelain commands such aslog,diff,show,blame,branchandtag -ldo.- Exit status of Git is not affected by quitting the pager early, though a SIGPIPE may cut a long script output.
- Scripts: use
--no-pageror pipe the output; do not rely on how a user has configured paging. - Interactive editors:
git helpuses a different setting,man.viewer, andhelp.format.
Related
core.editor,color.*,git log,git config- Lessons: Log and show, Setup and config