Skip to contentSkip to conversation

Move --pretty options into Documentation/pretty-formats.txt

PATCH In review Chris Riddoch 2 participants 2 messages Aug 11, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Move --pretty options into Documentation/pretty-formats.txt

Asciidoc-include it into the manuals for programs that use the --pretty command-line option, for consistency among the docs.

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.

---
 Documentation/git-diff-tree.txt  |    7 ++---
 Documentation/git-log.txt        |    3 +-
 Documentation/git-rev-list.txt   |    6 +---
 Documentation/git-show.txt       |    5 +---
 Documentation/pretty-formats.txt |   56 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 62 insertions(+), 15 deletions(-)
Documentation/git-diff-tree.txt +3 -4
index f7e8ff2..add0d2f 100644
@@ -73,10 +73,9 @@ separated with a single space are given.
 	This flag causes "git-diff-tree --stdin" to also show
 	the commit message before the differences.
 
---pretty[=(raw|medium|short)]::
-	This is used to control "pretty printing" format of the
-	commit message.  Without "=<style>", it defaults to
-	medium.
+
+include::pretty-formats.txt[]
+
 
 --no-commit-id::
 	git-diff-tree outputs a line with the commit ID when
Documentation/git-log.txt +1 -2
index c9ffff7..3f50b70 100644
@@ -24,8 +24,7 @@ This manual page describes only the most
 
 OPTIONS
 -------
---pretty=<format>::
-	Controls the way the commit log is formatted.
+include::pretty-formats.txt[]
 
 --max-count=<n>::
 	Limits the number of commits to show.
Documentation/git-rev-list.txt +1 -5
index 00a95e2..ec43c0b 100644
@@ -79,11 +79,7 @@ Using these options, gitlink:git-rev-lis
 more specialized family of commit log tools: gitlink:git-log[1],
 gitlink:git-show[1], and gitlink:git-whatchanged[1]
 
---pretty[='<format>']::
-
-	Pretty print the contents of the commit logs in a given format,
-	where '<format>' can be one of 'raw', 'medium', 'short', 'full',
-	and 'oneline'. When left out the format default to 'medium'.
+include::pretty-formats.txt[]
 
 --relative-date::
 
Documentation/git-show.txt +1 -4
index 2b4df3f..4c880a8 100644
@@ -26,10 +26,7 @@ OPTIONS
 <commitid>::
 	ID of the commit to show.
 
---pretty=<format>::
-	Controls the output format for the commit logs.
-	<format> can be one of 'raw', 'medium', 'short', 'full',
-	and 'oneline'.
+include::pretty-formats.txt[]
 
 Author
 ------
Documentation/pretty-formats.txt new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.4.4
#1 lore raw
Quoted 3 lines · Chris Riddoch

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.

Documentation/pretty-formats.txt line 10

Quoted 12 lines
Documentation/pretty-formats.txt new file +10 -0
@@ -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/