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

Re: [PATCH] Move --pretty options into Documentation/pretty-formats.txt

From
Junio C Hamano <junkio@cox.net>
Date
Nov 18, 2006, 19:39 UTC
Message-ID
<7virhccznk.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<11638310552964-git-send-email-chris@syntacticsugar.org>
Chris Riddoch <chris@syntacticsugar.org> writes:
> This describes all the pretty-formats currently listed in the cmit_fmt
> enum in commit.h, and also briefly describes the presence and format
> of the 'Merge: ' line in some pretty formats.
Thanks.  Getting much warmer.
Show 7 quoted lines
> @@ -0,0 +1,56 @@
> +--pretty[='<format>']::
> +
> +        Pretty-prints the details of a commit.  The default format is
> +        'medium'.  If the commit is a merge, and the pretty-format is
> +        not 'oneline', 'email' or 'raw', an additional line is
> +        inserted before the 'Author:' line.  This line begins with
> +        "Merge: " and the sha1s of each parent commit are printed,
> +        separated by spaces.  These sha1's are abbreviated to 8
> +        characters; use the --abbrev or --no-abbrev options to alter
> +        this behavior.

The default abbreviation depends on the command. Porcelain-ish commands default to abbreviate but plumbing commands tend to show unabbreviated.

A few other things to note.
 - When --parents option is in effect, you will see the list of
   parent commits on "commit" line after the commit itself.
 - The list of parents shown on "Merge:" may be different from
   the true parents when the command's revision traversal is
   limited with paths parameters; they show simplified parents.
   This rule also applies to the parents on the "commit" line
   under --parents option.
 - The history simplification does not affect "parent" line of
   "--pretty=raw" format.  You can use this to find the
   simplified parents from "commit" line and the true parents
   from "parent" lines with --pretty=raw.

Here are some examples from git.git repository to illustrate differences between various combinations.

    C=2a54323
    git diff-tree -s -m --pretty=$format $C
    git diff-tree -s -m --pretty=$format --abbrev $C
    git diff-tree -s -m --pretty=$format --abbrev --abbrev-commit $C
    git log --pretty=$format --parents -n 1 --abbrev-commit $C
    git log --pretty=$format --parents -n 1 $C
    git log --pretty=$format --parents -n 1 $C -- t/
Previous: Chris Riddoch
Message 2 of 2 in “Move --pretty options into Documentation/pretty-formats.txt”
  1. Move --pretty options into Documentation/pretty-formats.txtChris Riddoch, Nov 18, 2006
  2. Junio C HamanoNov 18, 2006

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.