show-ref

NAME

git-show-ref - List references in a local repositorygit-show-ref - ローカルリポジトリ内の参照を一覧表示する

SYNOPSIS概要

git show-ref [-q|--quiet] [--verify] [--head] [-d|--dereference]
	     [-s|--hash[=<n>]] [--abbrev[=<n>]] [--tags]
	     [--heads] [--] [<pattern>…​]
git show-ref --exclude-existing[=<pattern>]

DESCRIPTION説明

Displays references available in a local repository along with the associated commit IDs. Results can be filtered using a pattern and tags can be dereferenced into object IDs. Additionally, it can be used to test whether a particular ref exists.関連付けられているコミットIDとともに、ローカルリポジトリで利用可能な参照を表示します。結果はパターンを使用してフィルタリングでき、タグはオブジェクトIDに間接参照できます。さらに、特定の参照が存在するかどうかをテストするために使用できます。

By default, shows the tags, heads, and remote refs.デフォルトでは、タグ、ヘッド、およびリモート参照を表示します。

The --exclude-existing form is a filter that does the inverse. It reads refs from stdin, one ref per line, and shows those that don’t exist in the local repository.--exclude-existing形式はその逆を行うフィルタです。それは標準入力から1行に1つの参照を読み込み、ローカルリポジトリに存在しないものを表示します。

Use of this utility is encouraged in favor of directly accessing files under the .git directory.このユーティリティを使用すると、.gitディレクトリ下のファイルに直接アクセスすることができます。

OPTIONSオプション

--head - 頭

Show the HEAD reference, even if it would normally be filtered out.通常は除外されている場合でも、HEAD参照を表示します。

--heads - 頭
--tags - タグ

Limit to "refs/heads" and "refs/tags", respectively. These options are not mutually exclusive; when given both, references stored in "refs/heads" and "refs/tags" are displayed.それぞれ "refs / heads"と "refs / tags"に制限してください。これらのオプションは相互に排他的ではありません。両方を指定すると、 "refs / heads"と "refs / tags"に格納されている参照が表示されます。

-d
--dereference

Dereference tags into object IDs as well. They will be shown with "^{}" appended.タグをオブジェクトIDにも参照します。それらは "^ {}"を付けて表示されます。

-s
--hash[=<n>] --hash [= <n>]

Only show the SHA-1 hash, not the reference name. When combined with --dereference the dereferenced tag will still be shown after the SHA-1.SHA-1ハッシュのみを表示し、参照名は表示しません。--dereferenceと組み合わせると、参照解除されたタグはSHA-1の後に表示されます。

--verify - 確認する

Enable stricter reference checking by requiring an exact ref path. Aside from returning an error code of 1, it will also print an error message if --quiet was not specified.正確な参照パスを要求することで、より厳密な参照チェックを有効にします。エラーコード1を返す以外に、--quiet指定されていなければエラーメッセージも表示します。

--abbrev[=<n>] --abbrev [= <n>]

Abbreviate the object name. When using --hash, you do not have to say --hash --abbrev; --hash=n would do.オブジェクト名を省略します。使うとき--hashは、言う必要はありません--hash --abbrev--hash=nするだろう。

-q
--quiet - 静か

Do not print any results to stdout. When combined with --verify this can be used to silently check if a reference exists.結果を標準出力に表示しません。これと組み合わせると--verify、参照が存在するかどうかを黙って確認するために使用できます。

--exclude-existing[=<pattern>] --exclude-existing [= <パターン>]

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.作るGitのショー-REF形「の標準入力からREFを読み取るフィルタとして作用する^(?:<anything>\s)?<refname>(?:\^{})?$」とそれぞれに次のアクションを実行し、(1)ストリップ「^ {}」行の終わりにある場合。(2)patternが指定されていてrefnameの先頭に一致しない場合は無視します。(3)refnameが正しい形式のrefnameではない場合は警告してスキップする。(4)refnameがローカルリポジトリに存在するrefであるかどうかを無視する。(5)それ以外の場合は行を出力します。

<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.1つ以上のパターンに一致する参照を表示します。パターンは、フルネームの端からマッチングされ、そして唯一の完全な部分が一致している、例えばマスター試合レフリー/ヘッド/マスターレフリー/リモコン/起源/マスターレフリー/タグ/ジェダイ/マスターではなく、レフリー/ヘッド/ mymasterまたはレフリー/リモコン/マスター/ジェダイ

OUTPUT出力

The output is in the format: <SHA-1 ID> <space> <reference name>.出力は、<SHA-1 ID> <スペース> <参照名>の形式になります。

$ 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 format is: <SHA-1 ID>--hash(--dereferenceではなく)を使用すると、出力形式は<SHA-1 ID>になります。

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

EXAMPLES

To show all references called "master", whether tags or heads or anything else, and regardless of how deep in the reference naming hierarchy they are, use:"master"と呼ばれるすべての参照を表示するには、タグやヘッドなど、その他の参照の名前付け階層の深さに関係なく、次のようにします。

	git show-ref master

This will show "refs/heads/master" but also "refs/remote/other-repo/master", if such references exists.そのような参照が存在する場合、これは "refs / heads / master"だけでなく "refs / remote / other-repo / master"も表示します。

When using the --verify flag, the command requires an exact path:--verifyフラグを使用するとき、コマンドは正確なパスを必要とします。

	git show-ref --verify refs/heads/master

will only match the exact branch called "master"."master"と呼ばれる正確なブランチにのみマッチします。

If nothing matches, git show-ref will return an error code of 1, and in the case of verification, it will show an error message.何も一致しない場合、git show-refはエラーコード1を返し、検証の場合はエラーメッセージを表示します。

For scripting, you can ask it to be quiet with the "--quiet" flag, which allows you to do things likeスクリプティングの場合は、 " - quiet"フラグを使用して静かにすることができます。これにより、次のようなことができます。

	git show-ref --quiet --verify -- "refs/heads/$headname" ||
		echo "$headname is not a valid branch"

to check whether a particular branch exists or not (notice how we don’t actually want to show any results, and we want to use the full refname for it in order to not trigger the problem with ambiguous partial matches).特定のブランチが存在するかどうかを確認します(実際には結果を表示したくないので、あいまいな部分一致で問題が発生しないようにするために完全なrefnameを使用します)。

To show only tags, or only proper branch heads, use "--tags" and/or "--heads" respectively (using both means that it shows tags and heads, but not other random references under the refs/ subdirectory).タグのみ、または適切なブランチヘッドのみを表示するには、それぞれ "--tags"または "--heads"を使用します(両方を使用すると、タグとヘッドは表示されますが、refs /サブディレクトリの下のランダム参照は表示されません)。

To do automatic tag object dereferencing, use the "-d" or "--dereference" flag, so you can do自動タグオブジェクトの間接参照を行うには、 " - d"または "--dereference"フラグを使用します。

	git show-ref --tags --dereference

to get a listing of all tags together with what they dereference.それらが間接参照するものと共にすべてのタグのリストを得るため。

FILESファイル

.git/refs/*, .git/packed-refs.git/refs/*.git/packed-refs

SEE ALSO関連項目

git-for-each-ref[1], git-ls-remote[1], git-update-ref[1], gitrepository-layout[5]git-for-each-ref [1]git-ls-remote [1]git-update-ref [1]gitrepository-layout [5]

GIT

Part of the git[1] suite一部のgit [1]スイート

関連記事

スポンサーリンク

ナインパッチとは(9-Patch)

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る