tags:

views:

55

answers:

1

Is there a command line argument to pass to git diff and other commands, that use the less pager by default.

I know I can pipe it to cat; but that removes all the syntax highlighting;

I know I can set the pager in the global .gitconfig to cat by GITPAGER=cat (or something like that); but I want to have pager sometimes (depending on the size of the diff)

But, I prefer the command line option if there is one; and I am not able to find one, going thro' the man pages.

+3  A: 

--no-pager to git will tell it to not use a pager. -F to less will tell it to not page if the output fits in a single screen.

Ignacio Vazquez-Abrams
Thanks, I guess I can alias git --no-pager to gitc in .bashrc, right?
Lakshman Prasad
I don't see why not. I have no idea how it would react if used for a predicate that doesn't need a pager at all though.
Ignacio Vazquez-Abrams
Or use GIT_PAGER or PAGER environment variables, or `core.pager` git config variable.
Jakub Narębski