How do i get the git pager to clean up screen output after exit?

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


To clear the screen, but leave other behaviors untouched, you can do

git config --global core.pager 'less -+X'

This disables the -X option for less.

Tags:

Terminal

Git

Less