Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying git diff and git log output on a separate terminal screen

After setting up new development environment I encountered a strange git behavior that I don't recall seeing in the past.

I am used to git diff and git log creating a new screen in the terminal and displaying their output inside (what less does by default, and I'm using it as my pager).

I can then quit and go back to my previous terminal state, with the command output gone. Now, however, output is printed right into the same screen as if it was cat (but with a pager). Any ideas how to fix this? Couldn't find any info online.

UPDATE: Was able to fix this with @torek's help by setting core.pager to 'less -+F -+X'

like image 976
dols3m Avatar asked Oct 18 '25 09:10

dols3m


1 Answers

You probably have less set to use -X now, when you previously had less set not to use -X.

See my answer to How to display output of `git branch` on-screen in same CLI terminal?. Note that you can choose which pager to use, and/or whether to use a pager, too. (Well, you noted this in your question.)

like image 128
torek Avatar answered Oct 20 '25 00:10

torek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!