git
git status
command line
pagination
development tips

How can I turn on a pager for the output of git status?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

If git status produces more output than comfortably fits on one screen, you can force Git to send it through a pager such as less. Git already has a paging system, and you can enable it per command, per repository, or globally.

The two most useful answers are either "page this one invocation" or "always page git status." Which one you want depends on whether the long output is occasional or part of your normal workflow.

Page One Command Invocation

For a single run, use Git's paginate flag:

bash
git --paginate status

The short form is:

bash
git -p status

This tells Git to run status through the configured pager for that one invocation. It is the fastest answer when you do not want to change configuration yet.

Turn On Paging For git status Permanently

If you want git status to use a pager by default, configure pager.status:

bash
git config --global pager.status true

That changes the behavior for your user account across repositories. If you want the setting only in the current repository, omit --global:

bash
git config pager.status true

This is useful when one large monorepo needs paging but your smaller repositories do not.

Choose The Pager Program

Git usually uses less by default on systems where it is available, but you can control the pager explicitly with core.pager:

bash
git config --global core.pager "less -FRX"

Those less options are a common choice:

  • '-F quits if output fits on one screen'
  • '-R preserves color escape sequences'
  • '-X keeps the content on screen after exit'

Once core.pager is set, git status and other paged commands use that program unless a more specific override exists.

Verify What Git Will Use

If paging does not behave as expected, inspect the relevant config values:

bash
git config --global --get core.pager
git config --global --get pager.status
git var GIT_PAGER

git var GIT_PAGER is especially useful because it shows the effective pager after Git considers its config and environment variables.

Environment Variables Also Matter

Git also respects pager-related environment variables. For a temporary override:

bash
GIT_PAGER="less -FRX" git status

If you already have LESS or PAGER configured in your shell, those can also affect the viewing experience. That is why pager behavior sometimes differs between terminals even when the repository config is identical.

Know How To Turn It Back Off

Sometimes the real issue is the opposite: paging became annoying for a short command. You can disable paging for a one-off invocation:

bash
git --no-pager status

Or disable it in config:

bash
git config --global pager.status false

Knowing both directions makes it easier to experiment without getting stuck in a terminal behavior you dislike.

Why git status May Not Page By Default

Git's paging behavior varies by command, version, and configuration. Commands like git log are famously pager-friendly, while git status may or may not page depending on your setup. That is why forcing pagination explicitly with git --paginate status is the most dependable immediate answer.

For teams that use huge repositories, enabling a pager for status is often worthwhile because the untracked file list and branch summary can become too large for one terminal screen.

Common Pitfalls

One common mistake is setting core.pager but forgetting that pager.status may still be disabled. Another is choosing a pager command that strips color output or behaves awkwardly in the terminal. Developers also sometimes assume git status will always page automatically the same way git log often does, which is not guaranteed across setups. Finally, if the pager exits immediately, that may simply mean the output fits on one screen and the pager options told it to quit.

Summary

  • Use git --paginate status or git -p status to page a single invocation.
  • Use git config --global pager.status true to enable paging for git status by default.
  • Set core.pager if you want to choose the pager program and options.
  • Inspect git var GIT_PAGER when behavior is confusing.
  • Use git --no-pager status or pager.status false when you want to turn it back off.

Course illustration
Course illustration

All Rights Reserved.