0

Somehow my git outputs to a pager.
How can I get back its normal behavior -- output to tty directly?

More details -- I don't know if it's because I was copying configurations from someone else years ago, but many of my git commands output to a pager. For e.g., if I type git branch, my whole xterm window get cleared and a single line of * master is showing in less. If I type q to quit, I see nothing remains in my tty.

That's very annoying to me, but for years I've been put up with it, until now, when I cannot bear any more.

xpt
  • 20,363
  • 37
  • 127
  • 216
  • @JosephSible, yes, it's a duplicate (which is so hard to find the proper kw to search for it). Thanks – xpt Mar 14 '19 at 02:10
  • Sound like what you actually want is `LESS=X` so that `less` doesn't clear the screen when it's finished. – William Pursell Mar 14 '19 at 02:21
  • Ah! Thanks @WilliamPursell, that's another annoyance I've been put up with for years but don't know how to search for the answer. You've just saved me from another misery. thx again. – xpt Mar 15 '19 at 00:43

2 Answers2

0

To save people from more clicking, here is it:

git config --global --add core.pager "less -F -X"

without disabling the paging for other things.

xpt
  • 20,363
  • 37
  • 127
  • 216
0

to expand on what xpt wrote:

For one git command on current repo use:

git config pager.branch 'less -F -X'

For one git command on all repos use:

git config --global pager.branch 'less -F -X'

If it's just one-off use, it's better to use:

git --no-pager branch
chipfall
  • 300
  • 2
  • 6
  • Oh, just noticed that you're using `pager.branch`, how about `core.pager`, are they interchangeable? Would you give a link to backup your answer please? Thx. – xpt Mar 15 '19 at 00:39
  • It comes out of `git help git-config` or `git help git`. I ran into it trying to check the current branch via a script. – chipfall Mar 15 '19 at 02:26