Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
    
What if I only want to do this when runing git log with an -n option? – Crisfole 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
    
--no-pager option works like a charm! But seems like --no-pager needs to be supplied before "log" for it to work. You should update the answer to clarify this. "git log ... --no-pager" doesn't work, while "git --no-pager log ..." does. – CoolMcGrrr Jun 22 at 7:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .