28

I do all of my terminal work in emacs and would prefer to use the much richer tools for moving around the output than "less". Worse, any time an applications pages inside of emacs, it is horribly annoying because it is a dumb terminal.

While I can swap things like "git help rm" for "M-x man git-rm", I would prefer to just disable all paging of everything in git. Then I don't have to hunt for the right incantations.

  git config --global core.pager cat

Doesn't seem to do the trick.

  git config --global man.viewer "man -P cat"

causes problems because "man -P cat" isn't a valid executable.

How can I get git to just dump its output?

event_jr
  • 17,467
  • 4
  • 47
  • 62
Travis Jensen
  • 5,362
  • 3
  • 36
  • 40
  • 1
    `git -c core.pager=cat log` works just fine for me. – Lily Ballard Aug 28 '12 at 19:51
  • I really wish I could mark two answers as correct, because there are two things you need to do to really accomplish this. The first is turning off core.pager (see kan's answer). The second is turning of man paging (see geoff's answer). I marked Geoff's as the correct answer because I had already figured out the first but couldn't get the second firgured out. – Travis Jensen Aug 28 '12 at 21:18
  • 5
    I added `(setenv "PAGER" "cat")` to my Emacs init file and everything just worked. No git specific setting required. This has the added benefit that in a regular shell git works with its usual pager. – event_jr Jan 12 '13 at 06:52

5 Answers5

15

To disable pagination for all commands, set core.pager or GIT_PAGER to cat.

(c) http://www.kernel.org/pub/software/scm/git/docs/git-config.html

Addition. You also asked about git help. It actually not a git's pager, it is $MANPAGER. So maybe for you it will be enough just make PAGER=cat.

PAGER=cat git help log works with no pagers.

kan
  • 28,279
  • 7
  • 71
  • 101
  • As I mentioned in the original question, this didn't solve all of the problems. It is certainly a solution to part of the "problem", so an upvote is in order. – Travis Jensen Aug 28 '12 at 21:12
  • 1
    It works fine too if you set `GIT_PAGER` to an empty string: `GIT_PAGER= git log` (at least since git 1.8.x). – Diego Aug 04 '14 at 09:17
8

From reading the git help manpage it looks like you should be able to

git config --global man.viewer catman
git config --global man.catman.cmd "man -P cat"

The man.viewer config value is a tool name, not a (partial) command line. Then man.catman.cmd gives the command to use for the catman tool.

It seems like setting core.pager to cat should take care of everything else.

Geoff Reedy
  • 34,891
  • 3
  • 56
  • 79
5

Adding to Geoff Reedy's answer, this also gets rid of the _ and ^H in the man pages:

git config --global core.pager cat
git config --global man.viewer catman
git config --global man.catman.cmd 'man -P "col -b"'
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Venks I
  • 51
  • 1
  • 2
2

You could try alias git='git --no-pager'. Or if that doesn't work for some reason inside of emacs, you could create a git shell script somewhere earlier in your PATH that calls the real git --no-pager.

Lily Ballard
  • 182,031
  • 33
  • 381
  • 347
  • This was my first shot at it and it solved some of the problems, but not all of them. This is roughly equivalent to setting core.pager to cat above. – Travis Jensen Aug 28 '12 at 21:14
  • this was the only solution that did what I wanted, faster commands – CervEd Jun 06 '21 at 09:15
1

git config --global core.pager ""

works for me

Sérgio
  • 6,966
  • 1
  • 48
  • 53