How do I prevent ‘git diff’ from using a pager?

--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.


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

Leave a Comment