git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git rev-list --pretty=format:"" issue

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 17, 2013, 22:11 UTC
Message-ID
<7vk3o0erjq.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAH2yXXYggB=Wv-w4B9qU=ZxAuqjPVa5WRNZRnMRrWShkTp0UFg@mail.gmail.com>
Forrest Galloway <f.galloway@gmail.com> writes:
Show 13 quoted lines
> git 1.8.2.1 on OSX(Mountain Lion) installed with Homebrew
>
> I am seeing an issue when trying to format the output from rev-list command.
> git log --pretty=format:"%H - %an, %ar : %s" When I attempt the above
> string, instead of printing to the shell, LESS is opened and the
> output is displayed there.
>
>
> Got the command from here:
> http://git-scm.com/book/en/Git-Basics-Viewing-the-Commit-History
>
> git log --pretty=format:"%h - %an, %ar : %s" The string above works
> fine when I change the %h to %H the issue shoes up.
Actually, less is running in both cases.

We give --quit-if-one-screen (-F) and --chop-long-lines (-S) by default when we run "less", unless you have your own LESS environment variable to override our choice, if your history is shorter than one screenful *and* if your output lines are narrower than your terminal, it exits after showing the output.

By passing %H instead of %h, you make the output wider, and when viewing output with --chop-long-lines, less refuses to implicitly exit with --quit-if-one-screen, because you may want to look at the RHS end of the output with right/left arrow keys, and it cannot do so if it exits after showing the last line.

If you do not want pager, run it with no-pager, like this:
	git --no-pager log ...your other parameters...
Previous: Forrest GallowayNext: Thomas Rast
Message 2 of 3 in “git rev-list --pretty=format:"" issue”
  1. Forrest GallowayApr 17, 2013
  2. Junio C HamanoApr 17, 2013
  3. Thomas RastApr 18, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.