Skip to content

Commit 669b458

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 16950f8 commit 669b458

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

Documentation/git-rev-list.txt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,58 @@ include::rev-list-options.txt[]
3131

3232
include::pretty-formats.txt[]
3333

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 [email protected] --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+
3486
GIT
3587
---
3688
Part of the linkgit:git[1] suite

0 commit comments

Comments
 (0)