summaryrefslogtreecommitdiffstats
path: root/man1/git-for-each-ref.1
blob: 150d4af0acff3ab9962f86e40c91dcd1a3eae687 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
'\" t
.\"     Title: git-for-each-ref
.\"    Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 2024-04-10
.\"    Manual: Git Manual
.\"    Source: Git 2.44.0.568.g436d4e5b14
.\"  Language: English
.\"
.TH "GIT\-FOR\-EACH\-REF" "1" "2024\-04\-10" "Git 2\&.44\&.0\&.568\&.g436d4e" "Git Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
git-for-each-ref \- Output information on each ref
.SH "SYNOPSIS"
.sp
.nf
\fIgit for\-each\-ref\fR [\-\-count=<count>] [\-\-shell|\-\-perl|\-\-python|\-\-tcl]
                   [(\-\-sort=<key>)\&...] [\-\-format=<format>]
                   [\-\-include\-root\-refs] [ \-\-stdin | <pattern>\&... ]
                   [\-\-points\-at=<object>]
                   [\-\-merged[=<object>]] [\-\-no\-merged[=<object>]]
                   [\-\-contains[=<object>]] [\-\-no\-contains[=<object>]]
                   [\-\-exclude=<pattern> \&...]
.fi
.sp
.SH "DESCRIPTION"
.sp
Iterate over all refs that match \fB<pattern>\fR and show them according to the given \fB<format>\fR, after sorting them according to the given set of \fB<key>\fR\&. If \fB<count>\fR is given, stop after showing that many refs\&. The interpolated values in \fB<format>\fR can optionally be quoted as string literals in the specified host language allowing their direct evaluation in that language\&.
.SH "OPTIONS"
.PP
<pattern>\&...
.RS 4
If one or more patterns are given, only refs are shown that match against at least one pattern, either using fnmatch(3) or literally, in the latter case matching completely or from the beginning up to a slash\&.
.RE
.PP
\-\-stdin
.RS 4
If
\fB\-\-stdin\fR
is supplied, then the list of patterns is read from standard input instead of from the argument list\&.
.RE
.PP
\-\-count=<count>
.RS 4
By default the command shows all refs that match
\fB<pattern>\fR\&. This option makes it stop after showing that many refs\&.
.RE
.PP
\-\-sort=<key>
.RS 4
A field name to sort on\&. Prefix
\fB\-\fR
to sort in descending order of the value\&. When unspecified,
\fBrefname\fR
is used\&. You may use the \-\-sort=<key> option multiple times, in which case the last key becomes the primary key\&.
.RE
.PP
\-\-format=<format>
.RS 4
A string that interpolates
\fB%(fieldname)\fR
from a ref being shown and the object it points at\&. In addition, the string literal
\fB%%\fR
renders as
\fB%\fR
and
\fB%xx\fR
\- where
\fBxx\fR
are hex digits \- renders as the character with hex code
\fBxx\fR\&. For example,
\fB%00\fR
interpolates to
\fB\e0\fR
(NUL),
\fB%09\fR
to
\fB\et\fR
(TAB), and
\fB%0a\fR
to
\fB\en\fR
(LF)\&.
.sp
When unspecified,
\fB<format>\fR
defaults to
\fB%(objectname) SPC %(objecttype) TAB %(refname)\fR\&.
.RE
.PP
\-\-color[=<when>]
.RS 4
Respect any colors specified in the
\fB\-\-format\fR
option\&. The
\fB<when>\fR
field must be one of
\fBalways\fR,
\fBnever\fR, or
\fBauto\fR
(if
\fB<when>\fR
is absent, behave as if
\fBalways\fR
was given)\&.
.RE
.PP
\-\-shell, \-\-perl, \-\-python, \-\-tcl
.RS 4
If given, strings that substitute
\fB%(fieldname)\fR
placeholders are quoted as string literals suitable for the specified host language\&. This is meant to produce a scriptlet that can directly be `eval`ed\&.
.RE
.PP
\-\-points\-at=<object>
.RS 4
Only list refs which points at the given object\&.
.RE
.PP
\-\-merged[=<object>]
.RS 4
Only list refs whose tips are reachable from the specified commit (HEAD if not specified)\&.
.RE
.PP
\-\-no\-merged[=<object>]
.RS 4
Only list refs whose tips are not reachable from the specified commit (HEAD if not specified)\&.
.RE
.PP
\-\-contains[=<object>]
.RS 4
Only list refs which contain the specified commit (HEAD if not specified)\&.
.RE
.PP
\-\-no\-contains[=<object>]
.RS 4
Only list refs which don\(cqt contain the specified commit (HEAD if not specified)\&.
.RE
.PP
\-\-ignore\-case
.RS 4
Sorting and filtering refs are case insensitive\&.
.RE
.PP
\-\-omit\-empty
.RS 4
Do not print a newline after formatted refs where the format expands to the empty string\&.
.RE
.PP
\-\-exclude=<pattern>
.RS 4
If one or more patterns are given, only refs which do not match any excluded pattern(s) are shown\&. Matching is done using the same rules as
\fB<pattern>\fR
above\&.
.RE
.PP
\-\-include\-root\-refs
.RS 4
List root refs (HEAD and pseudorefs) apart from regular refs\&.
.RE
.SH "FIELD NAMES"
.sp
Various values from structured fields in referenced objects can be used to interpolate into the resulting output, or as sort keys\&.
.sp
For all objects, the following names can be used:
.PP
refname
.RS 4
The name of the ref (the part after $GIT_DIR/)\&. For a non\-ambiguous short name of the ref append
\fB:short\fR\&. The option core\&.warnAmbiguousRefs is used to select the strict abbreviation mode\&. If
\fBlstrip=<N>\fR
(\fBrstrip=<N>\fR) is appended, strips
\fB<N>\fR
slash\-separated path components from the front (back) of the refname (e\&.g\&.
\fB%(refname:lstrip=2)\fR
turns
\fBrefs/tags/foo\fR
into
\fBfoo\fR
and
\fB%(refname:rstrip=2)\fR
turns
\fBrefs/tags/foo\fR
into
\fBrefs\fR)\&. If
\fB<N>\fR
is a negative number, strip as many path components as necessary from the specified end to leave
\fB\-<N>\fR
path components (e\&.g\&.
\fB%(refname:lstrip=\-2)\fR
turns
\fBrefs/tags/foo\fR
into
\fBtags/foo\fR
and
\fB%(refname:rstrip=\-1)\fR
turns
\fBrefs/tags/foo\fR
into
\fBrefs\fR)\&. When the ref does not have enough components, the result becomes an empty string if stripping with positive <N>, or it becomes the full refname if stripping with negative <N>\&. Neither is an error\&.
.sp
\fBstrip\fR
can be used as a synonym to
\fBlstrip\fR\&.
.RE
.PP
objecttype
.RS 4
The type of the object (\fBblob\fR,
\fBtree\fR,
\fBcommit\fR,
\fBtag\fR)\&.
.RE
.PP
objectsize
.RS 4
The size of the object (the same as
\fIgit cat\-file \-s\fR
reports)\&. Append
\fB:disk\fR
to get the size, in bytes, that the object takes up on disk\&. See the note about on\-disk sizes in the
\fBCAVEATS\fR
section below\&.
.RE
.PP
objectname
.RS 4
The object name (aka SHA\-1)\&. For a non\-ambiguous abbreviation of the object name append
\fB:short\fR\&. For an abbreviation of the object name with desired length append
\fB:short=<length>\fR, where the minimum length is MINIMUM_ABBREV\&. The length may be exceeded to ensure unique object names\&.
.RE
.PP
deltabase
.RS 4
This expands to the object name of the delta base for the given object, if it is stored as a delta\&. Otherwise it expands to the null object name (all zeroes)\&.
.RE
.PP
upstream
.RS 4
The name of a local ref which can be considered \(lqupstream\(rq from the displayed ref\&. Respects
\fB:short\fR,
\fB:lstrip\fR
and
\fB:rstrip\fR
in the same way as
\fBrefname\fR
above\&. Additionally respects
\fB:track\fR
to show "[ahead N, behind M]" and
\fB:trackshort\fR
to show the terse version: ">" (ahead), "<" (behind), "<>" (ahead and behind), or "=" (in sync)\&.
\fB:track\fR
also prints "[gone]" whenever unknown upstream ref is encountered\&. Append
\fB:track,nobracket\fR
to show tracking information without brackets (i\&.e "ahead N, behind M")\&.
.sp
For any remote\-tracking branch
\fB%(upstream)\fR,
\fB%(upstream:remotename)\fR
and
\fB%(upstream:remoteref)\fR
refer to the name of the remote and the name of the tracked remote ref, respectively\&. In other words, the remote\-tracking branch can be updated explicitly and individually by using the refspec
\fB%(upstream:remoteref):%(upstream)\fR
to fetch from
\fB%(upstream:remotename)\fR\&.
.sp
Has no effect if the ref does not have tracking information associated with it\&. All the options apart from
\fBnobracket\fR
are mutually exclusive, but if used together the last option is selected\&.
.RE
.PP
push
.RS 4
The name of a local ref which represents the
\fB@{push}\fR
location for the displayed ref\&. Respects
\fB:short\fR,
\fB:lstrip\fR,
\fB:rstrip\fR,
\fB:track\fR,
\fB:trackshort\fR,
\fB:remotename\fR, and
\fB:remoteref\fR
options as
\fBupstream\fR
does\&. Produces an empty string if no
\fB@{push}\fR
ref is configured\&.
.RE
.PP
HEAD
.RS 4
\fI*\fR
if HEAD matches current ref (the checked out branch), \*(Aq \*(Aq otherwise\&.
.RE
.PP
color
.RS 4
Change output color\&. Followed by
\fB:<colorname>\fR, where color names are described under Values in the "CONFIGURATION FILE" section of
\fBgit-config\fR(1)\&. For example,
\fB%(color:bold red)\fR\&.
.RE
.PP
align
.RS 4
Left\-, middle\-, or right\-align the content between %(align:\&...) and %(end)\&. The "align:" is followed by
\fBwidth=<width>\fR
and
\fBposition=<position>\fR
in any order separated by a comma, where the
\fB<position>\fR
is either left, right or middle, default being left and
\fB<width>\fR
is the total length of the content with alignment\&. For brevity, the "width=" and/or "position=" prefixes may be omitted, and bare <width> and <position> used instead\&. For instance,
\fB%(align:<width>,<position>)\fR\&. If the contents length is more than the width then no alignment is performed\&. If used with
\fB\-\-quote\fR
everything in between %(align:\&...) and %(end) is quoted, but if nested then only the topmost level performs quoting\&.
.RE
.PP
if
.RS 4
Used as %(if)\&...%(then)\&...%(end) or %(if)\&...%(then)\&...%(else)\&...%(end)\&. If there is an atom with value or string literal after the %(if) then everything after the %(then) is printed, else if the %(else) atom is used, then everything after %(else) is printed\&. We ignore space when evaluating the string before %(then), this is useful when we use the %(HEAD) atom which prints either "*" or " " and we want to apply the
\fIif\fR
condition only on the
\fIHEAD\fR
ref\&. Append ":equals=<string>" or ":notequals=<string>" to compare the value between the %(if:\&...) and %(then) atoms with the given string\&.
.RE
.PP
symref
.RS 4
The ref which the given symbolic ref refers to\&. If not a symbolic ref, nothing is printed\&. Respects the
\fB:short\fR,
\fB:lstrip\fR
and
\fB:rstrip\fR
options in the same way as
\fBrefname\fR
above\&.
.RE
.PP
signature
.RS 4
The GPG signature of a commit\&.
.RE
.PP
signature:grade
.RS 4
Show "G" for a good (valid) signature, "B" for a bad signature, "U" for a good signature with unknown validity, "X" for a good signature that has expired, "Y" for a good signature made by an expired key, "R" for a good signature made by a revoked key, "E" if the signature cannot be checked (e\&.g\&. missing key) and "N" for no signature\&.
.RE
.PP
signature:signer
.RS 4
The signer of the GPG signature of a commit\&.
.RE
.PP
signature:key
.RS 4
The key of the GPG signature of a commit\&.
.RE
.PP
signature:fingerprint
.RS 4
The fingerprint of the GPG signature of a commit\&.
.RE
.PP
signature:primarykeyfingerprint
.RS 4
The primary key fingerprint of the GPG signature of a commit\&.
.RE
.PP
signature:trustlevel
.RS 4
The trust level of the GPG signature of a commit\&. Possible outputs are
\fBultimate\fR,
\fBfully\fR,
\fBmarginal\fR,
\fBnever\fR
and
\fBundefined\fR\&.
.RE
.PP
worktreepath
.RS 4
The absolute path to the worktree in which the ref is checked out, if it is checked out in any linked worktree\&. Empty string otherwise\&.
.RE
.PP
ahead\-behind:<committish>
.RS 4
Two integers, separated by a space, demonstrating the number of commits ahead and behind, respectively, when comparing the output ref to the
\fB<committish>\fR
specified in the format\&.
.RE
.PP
describe[:options]
.RS 4
A human\-readable name, like
\fBgit-describe\fR(1); empty string for undescribable commits\&. The
\fBdescribe\fR
string may be followed by a colon and one or more comma\-separated options\&.
.PP
tags=<bool\-value>
.RS 4
Instead of only considering annotated tags, consider lightweight tags as well; see the corresponding option in
\fBgit-describe\fR(1)
for details\&.
.RE
.PP
abbrev=<number>
.RS 4
Use at least <number> hexadecimal digits; see the corresponding option in
\fBgit-describe\fR(1)
for details\&.
.RE
.PP
match=<pattern>
.RS 4
Only consider tags matching the given
\fBglob(7)\fR
pattern, excluding the "refs/tags/" prefix; see the corresponding option in
\fBgit-describe\fR(1)
for details\&.
.RE
.PP
exclude=<pattern>
.RS 4
Do not consider tags matching the given
\fBglob(7)\fR
pattern, excluding the "refs/tags/" prefix; see the corresponding option in
\fBgit-describe\fR(1)
for details\&.
.RE
.RE
.sp
In addition to the above, for commit and tag objects, the header field names (\fBtree\fR, \fBparent\fR, \fBobject\fR, \fBtype\fR, and \fBtag\fR) can be used to specify the value in the header field\&. Fields \fBtree\fR and \fBparent\fR can also be used with modifier \fB:short\fR and \fB:short=<length>\fR just like \fBobjectname\fR\&.
.sp
For commit and tag objects, the special \fBcreatordate\fR and \fBcreator\fR fields will correspond to the appropriate date or name\-email\-date tuple from the \fBcommitter\fR or \fBtagger\fR fields depending on the object type\&. These are intended for working on a mix of annotated and lightweight tags\&.
.sp
For tag objects, a \fBfieldname\fR prefixed with an asterisk (\fB*\fR) expands to the \fBfieldname\fR value of the peeled object, rather than that of the tag object itself\&.
.sp
Fields that have name\-email\-date tuple as its value (\fBauthor\fR, \fBcommitter\fR, and \fBtagger\fR) can be suffixed with \fBname\fR, \fBemail\fR, and \fBdate\fR to extract the named component\&. For email fields (\fBauthoremail\fR, \fBcommitteremail\fR and \fBtaggeremail\fR), \fB:trim\fR can be appended to get the email without angle brackets, and \fB:localpart\fR to get the part before the \fB@\fR symbol out of the trimmed email\&. In addition to these, the \fB:mailmap\fR option and the corresponding \fB:mailmap,trim\fR and \fB:mailmap,localpart\fR can be used (order does not matter) to get values of the name and email according to the \&.mailmap file or according to the file set in the mailmap\&.file or mailmap\&.blob configuration variable (see \fBgitmailmap\fR(5))\&.
.sp
The raw data in an object is \fBraw\fR\&.
.PP
raw:size
.RS 4
The raw data size of the object\&.
.RE
.sp
Note that \fB\-\-format=%(raw)\fR can not be used with \fB\-\-python\fR, \fB\-\-shell\fR, \fB\-\-tcl\fR, because such language may not support arbitrary binary data in their string variable type\&.
.sp
The message in a commit or a tag object is \fBcontents\fR, from which \fBcontents:<part>\fR can be used to extract various parts out of:
.PP
contents:size
.RS 4
The size in bytes of the commit or tag message\&.
.RE
.PP
contents:subject
.RS 4
The first paragraph of the message, which typically is a single line, is taken as the "subject" of the commit or the tag message\&. Instead of
\fBcontents:subject\fR, field
\fBsubject\fR
can also be used to obtain same results\&.
\fB:sanitize\fR
can be appended to
\fBsubject\fR
for subject line suitable for filename\&.
.RE
.PP
contents:body
.RS 4
The remainder of the commit or the tag message that follows the "subject"\&.
.RE
.PP
contents:signature
.RS 4
The optional GPG signature of the tag\&.
.RE
.PP
contents:lines=N
.RS 4
The first
\fBN\fR
lines of the message\&.
.RE
.sp
Additionally, the trailers as interpreted by \fBgit-interpret-trailers\fR(1) are obtained as \fBtrailers[:options]\fR (or by using the historical alias \fBcontents:trailers[:options]\fR)\&. For valid [:option] values see \fBtrailers\fR section of \fBgit-log\fR(1)\&.
.sp
For sorting purposes, fields with numeric values sort in numeric order (\fBobjectsize\fR, \fBauthordate\fR, \fBcommitterdate\fR, \fBcreatordate\fR, \fBtaggerdate\fR)\&. All other fields are used to sort in their byte\-value order\&.
.sp
There is also an option to sort by versions, this can be done by using the fieldname \fBversion:refname\fR or its alias \fBv:refname\fR\&.
.sp
In any case, a field name that refers to a field inapplicable to the object referred by the ref does not cause an error\&. It returns an empty string instead\&.
.sp
As a special case for the date\-type fields, you may specify a format for the date by adding \fB:\fR followed by date format name (see the values the \fB\-\-date\fR option to \fBgit-rev-list\fR(1) takes)\&. If this formatting is provided in a \fB\-\-sort\fR key, references will be sorted according to the byte\-value of the formatted string rather than the numeric value of the underlying timestamp\&.
.sp
Some atoms like %(align) and %(if) always require a matching %(end)\&. We call them "opening atoms" and sometimes denote them as %($open)\&.
.sp
When a scripting language specific quoting is in effect, everything between a top\-level opening atom and its matching %(end) is evaluated according to the semantics of the opening atom and only its result from the top\-level is quoted\&.
.SH "EXAMPLES"
.sp
An example directly producing formatted text\&. Show the most recent 3 tagged commits:
.sp
.if n \{\
.RS 4
.\}
.nf
#!/bin/sh

git for\-each\-ref \-\-count=3 \-\-sort=\*(Aq\-*authordate\*(Aq \e
\-\-format=\*(AqFrom: %(*authorname) %(*authoremail)
Subject: %(*subject)
Date: %(*authordate)
Ref: %(*refname)

%(*body)
\*(Aq \*(Aqrefs/tags\*(Aq
.fi
.if n \{\
.RE
.\}
.sp
.sp
A simple example showing the use of shell eval on the output, demonstrating the use of \-\-shell\&. List the prefixes of all heads:
.sp
.if n \{\
.RS 4
.\}
.nf
#!/bin/sh

git for\-each\-ref \-\-shell \-\-format="ref=%(refname)" refs/heads | \e
while read entry
do
        eval "$entry"
        echo `dirname $ref`
done
.fi
.if n \{\
.RE
.\}
.sp
.sp
A bit more elaborate report on tags, demonstrating that the format may be an entire script:
.sp
.if n \{\
.RS 4
.\}
.nf
#!/bin/sh

fmt=\*(Aq
        r=%(refname)
        t=%(*objecttype)
        T=${r#refs/tags/}

        o=%(*objectname)
        n=%(*authorname)
        e=%(*authoremail)
        s=%(*subject)
        d=%(*authordate)
        b=%(*body)

        kind=Tag
        if test "z$t" = z
        then
                # could be a lightweight tag
                t=%(objecttype)
                kind="Lightweight tag"
                o=%(objectname)
                n=%(authorname)
                e=%(authoremail)
                s=%(subject)
                d=%(authordate)
                b=%(body)
        fi
        echo "$kind $T points at a $t object $o"
        if test "z$t" = zcommit
        then
                echo "The commit was authored by $n $e
at $d, and titled

    $s

Its message reads as:
"
                echo "$b" | sed \-e "s/^/    /"
                echo
        fi
\*(Aq

eval=`git for\-each\-ref \-\-shell \-\-format="$fmt" \e
        \-\-sort=\*(Aq*objecttype\*(Aq \e
        \-\-sort=\-taggerdate \e
        refs/tags`
eval "$eval"
.fi
.if n \{\
.RE
.\}
.sp
.sp
An example to show the usage of %(if)\&...%(then)\&...%(else)\&...%(end)\&. This prefixes the current branch with a star\&.
.sp
.if n \{\
.RS 4
.\}
.nf
git for\-each\-ref \-\-format="%(if)%(HEAD)%(then)* %(else)  %(end)%(refname:short)" refs/heads/
.fi
.if n \{\
.RE
.\}
.sp
.sp
An example to show the usage of %(if)\&...%(then)\&...%(end)\&. This prints the authorname, if present\&.
.sp
.if n \{\
.RS 4
.\}
.nf
git for\-each\-ref \-\-format="%(refname)%(if)%(authorname)%(then) Authored by: %(authorname)%(end)"
.fi
.if n \{\
.RE
.\}
.sp
.SH "CAVEATS"
.sp
Note that the sizes of objects on disk are reported accurately, but care should be taken in drawing conclusions about which refs or objects are responsible for disk usage\&. The size of a packed non\-delta object may be much larger than the size of objects which delta against it, but the choice of which object is the base and which is the delta is arbitrary and is subject to change during a repack\&.
.sp
Note also that multiple copies of an object may be present in the object database; in this case, it is undefined which copy\(cqs size or delta base will be reported\&.
.SH "NOTES"
.sp
When combining multiple \fB\-\-contains\fR and \fB\-\-no\-contains\fR filters, only references that contain at least one of the \fB\-\-contains\fR commits and contain none of the \fB\-\-no\-contains\fR commits are shown\&.
.sp
When combining multiple \fB\-\-merged\fR and \fB\-\-no\-merged\fR filters, only references that are reachable from at least one of the \fB\-\-merged\fR commits and from none of the \fB\-\-no\-merged\fR commits are shown\&.
.SH "SEE ALSO"
.sp
\fBgit-show-ref\fR(1)
.SH "GIT"
.sp
Part of the \fBgit\fR(1) suite