Home Explore Blog CI



git

2nd chunk of `Documentation/git-show-ref.adoc`
dded63dfc3226725dea91859487133f1a0e4ed1b574d651d000000010000088e
 --abbrev`; `--hash=n` would do.

-q::
--quiet::

	Do not print any results to stdout. Can be used with `--verify` to
	silently check if a reference exists.

--exclude-existing[=<pattern>]::

	Make `git show-ref` act as a filter that reads refs from stdin of the
	form `^(?:<anything>\s)?<refname>(?:\^{})?$`
	and performs the following actions on each:
	(1) strip `^{}` at the end of line if any;
	(2) ignore if pattern is provided and does not head-match refname;
	(3) warn if refname is not a well-formed refname and skip;
	(4) ignore if refname is a ref that exists in the local repository;
	(5) otherwise output the line.


<pattern>...::

	Show references matching one or more patterns. Patterns are matched from
	the end of the full name, and only complete parts are matched, e.g.
	'master' matches 'refs/heads/master', 'refs/remotes/origin/master',
	'refs/tags/jedi/master' but not 'refs/heads/mymaster' or
	'refs/remotes/master/jedi'.

OUTPUT
------

The output is in the format:

------------
<oid> SP <ref> LF
------------

For example,

-----------------------------------------------------------------------------
$ git show-ref --head --dereference
832e76a9899f560a90ffd62ae2ce83bbeff58f54 HEAD
832e76a9899f560a90ffd62ae2ce83bbeff58f54 refs/heads/master
832e76a9899f560a90ffd62ae2ce83bbeff58f54 refs/heads/origin
3521017556c5de4159da4615a39fa4d5d2c279b5 refs/tags/v0.99.9c
6ddc0964034342519a87fe013781abf31c6db6ad refs/tags/v0.99.9c^{}
055e4ae3ae6eb344cbabf2a5256a49ea66040131 refs/tags/v1.0rc4
423325a2d24638ddcc82ce47be5e40be550f4507 refs/tags/v1.0rc4^{}
...
-----------------------------------------------------------------------------

When using `--hash` (and not `--dereference`), the output is in the format:

------------
<oid> LF
------------

For example,

-----------------------------------------------------------------------------
$ git show-ref --branches --hash
2e3ba0114a1f52b47df29743d6915d056be13278
185008ae97960c8d551adcd9e23565194651b5d1
03adf42c988195b50e1a1935ba5fcbc39b2b029b
...
-----------------------------------------------------------------------------

EXAMPLES
--------

To show all references called "master", whether tags or heads or anything

Title: Git Show Ref Options and Output
Summary
The git show-ref command provides various options to customize its behavior, including filtering, dereferencing, and verifying references. The output format varies depending on the options used, such as displaying the reference name and OID, or only the OID. The command can be used to show references matching specific patterns, and its output can be used to inspect and manage a Git repository's references.