Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The pager less doesn't clear the screen as it should do when i use git.

I use less all the time and it usually doesn't leave output in the terminal after quit but when less gets executed via git it leaves the output in the terminal. I'm 100% sure git uses less on my system.

What is wrong with git and how do i fix it? pager = less in ~/.gitconfig doesn't help. $PAGER is also set to less.

share|improve this question
To clarify, git doesn't clear the screen by default, there is nothing wrong with your git. Use @ggustafsson's answer to change the default behaviour. – LeartS Nov 6 '14 at 10:25
up vote 21 down vote accepted

The solution is to set the variable LESS. Git defaults to less FRSX.

export LESS=R

Alternatively, you can modify the variable LESS when pager is called:

git config --global core.pager 'less -+$LESS -R'

See the core.pager section in man git-config

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.