SysTutorials

Linux Manual Pages › Section 1

git-for-each-ref(1)

NAME

git-for-each-ref – Output information on each ref

SYNOPSIS


git for-each-ref [--count=<count>] [--shell|--perl|--python|--tcl]
                   [(--sort=<key>)...] [--format=<format>] [<pattern>...]
                   [--points-at=<object>]
                   [--merged[=<object>]] [--no-merged[=<object>]]
                   [--contains[=<object>]] [--no-contains[=<object>]]

DESCRIPTION

Iterate over all refs that match <pattern> and show them according to the given <format>, after sorting them according to the given set of <key>. If <count> is given, stop after showing that many refs. The interpolated values in <format> can optionally be quoted as string literals in the specified host language allowing their direct evaluation in that language.

OPTIONS

<pattern>…

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.

–count=<count>

By default the command shows all refs that match <pattern>. This option makes it stop after showing that many refs.

–sort=<key>

A field name to sort on. Prefix – to sort in descending order of the value. When unspecified, refname is used. You may use the –sort=<key> option multiple times, in which case the last key becomes the primary key.

–format=<format>

A string that interpolates %(fieldname) from a ref being shown and the object it points at. If fieldname is prefixed with an asterisk (*) and the ref points at a tag object, use the value for the field in the object which the tag object refers to (instead of the field in the tag object). When unspecified, <format> defaults to %(objectname) SPC %(objecttype) TAB %(refname). It also interpolates %% to %, and %xx where xx are hex digits interpolates to character with hex code xx; for example %00 interpolates to