Start the 2.46 cycle
[alt-git.git] / Documentation / git-rev-list.txt
blob2e05c4b510927a66560ade549d9b7a05987e9d33
1 git-rev-list(1)
2 ===============
4 NAME
5 ----
6 git-rev-list - Lists commit objects in reverse chronological order
9 SYNOPSIS
10 --------
11 [verse]
12 'git rev-list' [<options>] <commit>... [--] [<path>...]
14 DESCRIPTION
15 -----------
17 :git-rev-list: 1
18 include::rev-list-description.txt[]
20 'rev-list' is an essential Git command, since it
21 provides the ability to build and traverse commit ancestry graphs. For
22 this reason, it has a lot of different options that enable it to be
23 used by commands as different as 'git bisect' and
24 'git repack'.
26 OPTIONS
27 -------
29 :git-rev-list: 1
30 include::rev-list-options.txt[]
32 include::pretty-formats.txt[]
34 EXAMPLES
35 --------
37 * Print the list of commits reachable from the current branch.
39 ----------
40 git rev-list HEAD
41 ----------
43 * Print the list of commits on this branch, but not present in the
44   upstream branch.
46 ----------
47 git rev-list @{upstream}..HEAD
48 ----------
50 * Format commits with their author and commit message (see also the
51   porcelain linkgit:git-log[1]).
53 ----------
54 git rev-list --format=medium HEAD
55 ----------
57 * Format commits along with their diffs (see also the porcelain
58   linkgit:git-log[1], which can do this in a single process).
60 ----------
61 git rev-list HEAD |
62 git diff-tree --stdin --format=medium -p
63 ----------
65 * Print the list of commits on the current branch that touched any
66   file in the `Documentation` directory.
68 ----------
69 git rev-list HEAD -- Documentation/
70 ----------
72 * Print the list of commits authored by you in the past year, on
73   any branch, tag, or other ref.
75 ----------
76 git rev-list --author=you@example.com --since=1.year.ago --all
77 ----------
79 * Print the list of objects reachable from the current branch (i.e., all
80   commits and the blobs and trees they contain).
82 ----------
83 git rev-list --objects HEAD
84 ----------
86 * Compare the disk size of all reachable objects, versus those
87   reachable from reflogs, versus the total packed size. This can tell
88   you whether running `git repack -ad` might reduce the repository size
89   (by dropping unreachable objects), and whether expiring reflogs might
90   help.
92 ----------
93 # reachable objects
94 git rev-list --disk-usage --objects --all
95 # plus reflogs
96 git rev-list --disk-usage --objects --all --reflog
97 # total disk size used
98 du -c .git/objects/pack/*.pack .git/objects/??/*
99 # alternative to du: add up "size" and "size-pack" fields
100 git count-objects -v
101 ----------
103 * Report the disk size of each branch, not including objects used by the
104   current branch. This can find outliers that are contributing to a
105   bloated repository size (e.g., because somebody accidentally committed
106   large build artifacts).
108 ----------
109 git for-each-ref --format='%(refname)' |
110 while read branch
112         size=$(git rev-list --disk-usage --objects HEAD..$branch)
113         echo "$size $branch"
114 done |
115 sort -n
116 ----------
118 * Compare the on-disk size of branches in one group of refs, excluding
119   another. If you co-mingle objects from multiple remotes in a single
120   repository, this can show which remotes are contributing to the
121   repository size (taking the size of `origin` as a baseline).
123 ----------
124 git rev-list --disk-usage --objects --remotes=$suspect --not --remotes=origin
125 ----------
129 Part of the linkgit:git[1] suite