When I use the "git log" command it is no longer implicitly piping through "less"
Asked Answered
G

5

21

Before, I could just type

git log

Now, I have to type:

git log | less

to get the same effect. I haven't (intentionally) changed any parameters. I've checked my global config: "~/.gitconfig" and my project Git config ".git/config" but I can't see anything that would cause this. All of the command parameters seem to be for opting out of this.

Furthermore, none of these work either:

git config --add --global core.pager less
git log

or

GIT_PAGER=less git log

or

PAGER=less git log
Gasperoni answered 16/1, 2014 at 13:36 Comment(3)
just a guess, but aside from 'global', check also the local setting stored in the specific repositoryOccasionalism
@Occasionalism I clarified my original question to address this. I checked both configs. I could be missing something, but I didn't see anything that could be causing it.Gasperoni
I'm having the exact opposite problem. I don't want git log to use less every time, I'd like to be able to pipe it to other things, like grep. How do I disable this?Strap
G
8

"did you try unplugging it and plugging it back in" I opened a new terminal and it stopped happening. I am still super curious though what in that other window's environment could be causing this, so I'll leave it open for awhile and if anyone has any ideas please let me know :)

Gasperoni answered 16/1, 2014 at 14:21 Comment(3)
I finally typed "exit" in the terminal, and when I did, I entered into a git log in less. I typed q, and then exit again and the terminal closed.Gasperoni
I'm having the same issue and it's been happening for months. Still no answer in sight.Andromeda
For me, it was because I fat-fingered something while within an existing got log command, which caused it to return to the command prompt but somehow wasn't completely reconnected to the TTY (or something, i'm not an expert on this stuff). Still not sure exactly how to reproduce though.Gasperoni
Z
6

There are two parameters that might affect this: the core.pager Git variable, and the $PAGER environment variable. Check what you have with

git config core.pager
echo $PAGER

One of them should be set to less

Zouave answered 16/1, 2014 at 13:43 Comment(3)
what is the output of git config core.pager and echo $PAGER?Zouave
git config core.pager returns "less". the syntax I used in my question is equivalent using the export command (but scoped to the current running command). But, for the sake of completeness, I did export PAGER=less and ran git log with the same issue, and echo $PAGER returns "less".Gasperoni
I don't understand what's happening to you, sorryZouave
A
4

I figured out the real reason when I had the issue on MSYS. It just needed the full path. e.g.

git config --add --global core.pager /usr/bin/less

(I suppose on Linux it would be similar.)

It's pretty obvious the underlying issue is that a quirk caused git to not be aware of the PATH.

Algo answered 22/6, 2018 at 23:38 Comment(0)
S
3

See the config variable core.pager: "The command that git will use to paginate output. Can be overridden with the GIT_PAGER environment variable."

Soelch answered 16/1, 2014 at 13:41 Comment(0)
A
1

setting git core.pager will ensure log outputs directed to pager:

git config --global core.pager less
Adventuresome answered 8/6, 2022 at 18:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.