git log -{n}, when -n is sufficiently small, doesn't open in less it simply prints it to the screen. That's desirable. git log -1 should not take up the full screen.

Unfortunately, in MINGW's bash shell, after I've run a non-git command, git log behaves as if I had ran it into less and pushed q. (in otherwords the data is printed to the bottom of the screen and I wind up with a pile of whitespace on top).

Imaginary demo (Please forgive its length):

>> clear









>> git log -1




commit 123123...
Author: CPfohl
Date: {today}
    {Message}

>> git log -1
commit 123123...
Author: CPfohl
Date: {today}
    {Message}

This works no matter what git command I execute before git log, as long as git log -{n} is after a git command.

Is this a bug, or is there a way to get this to behave normally?

link|improve this question
feedback

1 Answer

If you want to disable pagination for some/all git commands you can:

  • set configuration value (pager.<cmd> or core.pager for all commands) to cat
  • use --no-pager option

But maybe I haven't understood your question. Described behaviour should be possibly altered by setting appropriate pagination command (less with some options) in aforementioned configuration options.

link|improve this answer
What if I only want to do this when runing git log with an -n option? – Cpfohl Nov 18 '11 at 21:24
You may try to add command alias (including -n option) and for that alias use pager.alias_name = less .... But I don't know if the alias can be used as a comand in mentioned configuration option. – Martin Vejmelka Nov 18 '11 at 21:33
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.