5

I am using Kubuntu 16.4. LTS. Recently, I have updated my packages using the following commands:

sudo aptitude update && sudo aptitude upgrade

Since then, the command git log does not provide any output.

When using git log > /tmp/gitlog.txt however, the file contains the desired output.

How can I get git log working back?

Kos
  • 4,890
  • 9
  • 38
  • 42
lazyboy
  • 301
  • 3
  • 12

2 Answers2

5

Make sure you are in a local git repo, and make that you have a least one commit.

Your folder should include .git/ in it.

git log does not show anything on console, but git log > /tmp/gitlog.txt writes commits into the file in the pipe.

It may be a pager issue, which blocks the output on the console, but does not apply when redirecting to a file.
Check with git --no-pager log.


The OP lazyboy confirms in the comments an issue related to the pager:

the idea with pager helps me to check my system.
Some of startup scripts changed pager in my system and have affect to git.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • `git --no-pager` prints all log-entries to console, How to let `git log` work with pager? – lazyboy May 25 '18 at 09:01
  • Nops, I tried only `git --no-pager`. The command prints all entries to console. Not so usefull :( – lazyboy May 25 '18 at 11:20
  • @lazyboy Did you try `git --no-pager log 2> /tmp/gitlog.txt` (in case that command uses stderr for its output, as mentioned in https://stackoverflow.com/a/37771637/6309) – VonC May 25 '18 at 11:21
  • The answer does not help me directly to make git work again, but the idea with pager helps me to check my system. Some of startup scripts changed pager in my system and have affect to git. – lazyboy May 27 '18 at 14:51
  • @lazyboy Well spotted! I have included your comment in the answer for more visibility. – VonC May 27 '18 at 18:13
0

I encountered this exact same issue and fixed it by going into my .gitconfig file and deleting diff-highlight from the pager configs:

before (git log/diff/show not displaying anything):

[pager]
  log = diff-highlight | less
  show = diff-highlight | less
  diff = diff-highlight | less

after (everything works)

[pager]
  log = less
  show = less
  diff = less

no other pager config path setting or command flag work-arounds.

curiousgeorge
  • 232
  • 1
  • 6