docs/rev-list: add an examples section

We currently don't show any examples of using git-rev-list at all. Let's add some pretty elementary examples. They likely seem obvious to anybody who has worked with the tool for a while, but my purpose here is two-fold: - they may be enlightening to people who haven't used the tool a lot to give a general flavor of how it is meant to be used - they can serve as a starting point for adding more interesting examples (we can do that without the basic ones, of course, but I think it makes sense to show off the building blocks) This set is far from exhaustive, but again, the purpose is to be a starting point for further additions. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Feb 17, 2021 at 18:34 UTC 669b4587555597da7f2a875b95dc50f503b8187f
1 file changed +52
Documentation/git-rev-list.txt
+52
@@ -31,6 +31,58 @@ include::rev-list-options.txt[]
31
32 include::pretty-formats.txt[]
33
34 +EXAMPLES
35 +--------
36 +
37 +* Print the list of commits reachable from the current branch.
38 ++
39 +----------
40 +git rev-list HEAD
41 +----------
42 +
43 +* Print the list of commits on this branch, but not present in the
44 + upstream branch.
45 ++
46 +----------
47 +git rev-list @{upstream}..HEAD
48 +----------
49 +
50 +* Format commits with their author and commit message (see also the
51 + porcelain linkgit:git-log[1]).
52 ++
53 +----------
54 +git rev-list --format=medium HEAD
55 +----------
56 +
57 +* Format commits along with their diffs (see also the porcelain
58 + linkgit:git-log[1], which can do this in a single process).
59 ++
60 +----------
61 +git rev-list HEAD |
62 +git diff-tree --stdin --format=medium -p
63 +----------
64 +
65 +* Print the list of commits on the current branch that touched any
66 + file in the `Documentation` directory.
67 ++
68 +----------
69 +git rev-list HEAD -- Documentation/
70 +----------
71 +
72 +* Print the list of commits authored by you in the past year, on
73 + any branch, tag, or other ref.
74 ++
75 +----------
76 +git rev-list --author=you@example.com --since=1.year.ago --all
77 +----------
78 +
79 +* Print the list of objects reachable from the current branch (i.e., all
80 + commits and the blobs and trees they contain).
81 ++
82 +----------
83 +git rev-list --objects HEAD
84 +----------
85 +
86 GIT
87 ---
88 Part of the linkgit:git[1] suite