Is there a command line switch to pass to git diff
and other commands that use the less
pager by default? I know these methods exist:
git diff | cat
... removes all syntax highlightinggit config --global core.pager cat
sets the pager in the global .gitconfig to cat
export GIT_PAGER=cat
But I would prefer a command line switch.
--no-pager
to Git will tell it to not use a pager. Passing the option -F
to less
will tell it to not page if the output fits in a single screen.
Make sure that you add --no-pager
or -P
before your command, as in git --no-pager log...
.
Usage:
git --no-pager diff
Other options from the comments include:
# Set an evaporating environment variable to use 'cat' for your pager
GIT_PAGER=cat git diff
# Tells 'less' not to paginate if less than a page
export LESS="-F -X $LESS"
# ...then Git as usual
git diff
# short option alternative
git -P diff