]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-rev-list.txt
documentation: wording improvements
[thirdparty/git.git] / Documentation / git-rev-list.txt
CommitLineData
2cf565c5
DG
1git-rev-list(1)
2===============
2cf565c5
DG
3
4NAME
5----
6git-rev-list - Lists commit objects in reverse chronological order
7
8
9SYNOPSIS
10--------
353ce815 11[verse]
c08cfc39 12'git rev-list' [<options>] <commit>... [--] [<path>...]
2cf565c5
DG
13
14DESCRIPTION
15-----------
8c02eee2 16
bea86658 17:git-rev-list: 1
6be6b171 18include::rev-list-description.txt[]
8c02eee2 19
cf6cac20 20'rev-list' is an essential Git command, since it
8c02eee2
JF
21provides the ability to build and traverse commit ancestry graphs. For
22this reason, it has a lot of different options that enables it to be
0b444cdb
TR
23used by commands as different as 'git bisect' and
24'git repack'.
69e0c256 25
df8baa42
JF
26OPTIONS
27-------
8c02eee2 28
fdcf39e5
MV
29:git-rev-list: 1
30include::rev-list-options.txt[]
331b51d2
JN
31
32include::pretty-formats.txt[]
33
669b4587
JK
34EXAMPLES
35--------
36
37* Print the list of commits reachable from the current branch.
38+
39----------
40git rev-list HEAD
41----------
42
43* Print the list of commits on this branch, but not present in the
44 upstream branch.
45+
46----------
47git 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----------
54git 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----------
61git rev-list HEAD |
62git 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----------
69git 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----------
76git 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----------
83git rev-list --objects HEAD
84----------
85
a1db097e
JK
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.
91+
92----------
93# reachable objects
94git rev-list --disk-usage --objects --all
95# plus reflogs
96git rev-list --disk-usage --objects --all --reflog
97# total disk size used
98du -c .git/objects/pack/*.pack .git/objects/??/*
99# alternative to du: add up "size" and "size-pack" fields
100git count-objects -v
101----------
102
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).
107+
108----------
109git for-each-ref --format='%(refname)' |
110while read branch
111do
112 size=$(git rev-list --disk-usage --objects HEAD..$branch)
113 echo "$size $branch"
114done |
115sort -n
116----------
117
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).
122+
123----------
124git rev-list --disk-usage --objects --remotes=$suspect --not --remotes=origin
125----------
126
2cf565c5
DG
127GIT
128---
9e1f0a85 129Part of the linkgit:git[1] suite