Links
Vars for `--format``
--format
performs interpolations in the string.
Default: %(objectname) SPC %(objecttype) TAB %(refname)
For example, you can interpolate %(foo)
from the object pointed at by a ref
being shown. If foo
is prefixed with an asterisk
(*
)
and the ref points at a tag object, the value for the field
in the object tag refers is used.
It also interpolates %%
to %
, and %xx
where xx
are hex digits
interpolates to character with hex code xx
; for example
%00
interpolates to \0
(NUL
), %09
to \t
and %0a
to \n
.
Name | Description |
---|---|
refname |
The name of the ref (the part after $GIT_DIR/ ). For a non-ambiguous short name of the ref append :short . The option core .warnAmbiguousRefs is used to select the strict abbreviation mode. |
objecttype |
The type of the object (blob, tree, commit, tag). |
objectsize |
The size of the object (the same as git cat-file -s reports). |
objectname |
The object name (aka SHA-1). For a non-ambiguous abbreviation of the object name append :short . |
upstream |
The name of a local ref which can be considered upstream from the displayed ref. Respects :short in the same way as refname above. |
For commit and tag objects, you can also specify: tree
, parent
, object
, type
, and tag
Snippets
# These two are equivalent git for-each-ref --format '%(objectname)' -- 'refs/remotes/chirayu/presubmit*' git rev-parse --glob='refs/remotes/chirayu/presubmit*'