Reputation: 21
When calling git log
or git diff
in the terminal the result is displayed using some kind of viewer. I know how to navigate, quit and search for keywords but wanted to have some background on what I am actually doing. What is this viewer's name and where is this viewer documented?
I know the editor goes to my default text editor but this "viewer" seems to be something else. I have been looking for it for a while but I am not sure I am searching using the correct keywords.
Upvotes: 2
Views: 208
Reputation: 3596
git use less
for default viewer, you can look manpage of less to find how to search in it.
Upvotes: 1
Reputation: 2853
The default viewer is less
:
core.pager
Text viewer for use by Git commands (e.g., less). The value is meant to be interpreted by the shell. The order of preference is the
$GIT_PAGER
environment variable, thencore.pager
configuration, then$PAGER
, and then the default chosen at compile time (usually less).When the
LESS
environment variable is unset, Git sets it toFRX
(ifLESS
environment variable is set, Git does not change it at all). If you want to selectively override Git’s default setting forLESS
, you can setcore.pager
to e.g.less -S
. This will be passed to the shell by Git, which will translate the final command toLESS=FRX less -S
. The environment does not set theS
option but the command line does, instructing less to truncate long lines. Similarly, settingcore.pager
toless -+F
will deactivate theF
option specified by the environment from the command-line, deactivating the "quit if one screen" behavior ofless
. One can specifically activate some flags for particular commands: for example, settingpager.blame
toless -S
enables line truncation only for git blame.Likewise, when the
LV
environment variable is unset, Git sets it to-c
. You can override this setting by exportingLV
with another value or settingcore.pager
tolv +c
.
https://git-scm.com/docs/git-config
Upvotes: 1
Reputation: 311273
The default viewer for git is less
. You can change it to something else (e.g., more
) by setting the code.pager
config value. E.g.:
$ git config --global core.pager more
You can find out more in the Git Configuration documentation.
Upvotes: 3