symbolic-ref
NAME名
git-symbolic-ref - Read, modify and delete symbolic refsgit-symbolic-ref - シンボリック参照の読み込み、変更、削除
SYNOPSIS概要
git symbolic-ref [-m <reason>] <name> <ref> git symbolic-ref [-q] [--short] <name> git symbolic-ref --delete [-q] <name>
DESCRIPTION説明
Given one argument, reads which branch head the given symbolic
ref refers to and outputs its path, relative to the .git/
directory. Typically you would give HEAD
as the <name>
argument to see which branch your working tree is on.引数を1つ指定して、指定されたシンボリック参照がどのブランチヘッドを参照しているかを読み取り、.git/
ディレクトリからの相対パスを出力します。通常HEAD
、作業ツリーがどのブランチにあるかを見るために、<name>引数として与えます。
Given two arguments, creates or updates a symbolic ref <name> to point at the given branch <ref>.2つの引数が与えられると、与えられたブランチ<ref>を指すようにシンボリックref <name>を作成または更新します。
Given --delete
and an additional argument, deletes the given
symbolic ref.与えられ--delete
た引数と追加の引数で、与えられたシンボリック参照を削除します。
A symbolic ref is a regular file that stores a string that
begins with ref: refs/
. For example, your .git/HEAD
is
a regular file whose contents is ref: refs/heads/master
.シンボリック参照は、で始まる文字列を格納する通常のファイルですref: refs/
。たとえば、あなたの.git/HEAD
内容は普通のファイルですref: refs/heads/master
。
OPTIONSオプション
- -d
- --delete - 削除
-
Delete the symbolic ref <name>.シンボリック参照<名前>を削除します。
- -q
- --quiet - 静か
-
Do not issue an error message if the <name> is not a symbolic ref but a detached HEAD; instead exit with non-zero status silently.<name>がシンボリック参照ではなく、切り離されたHEADである場合、エラーメッセージを発行しません。代わりに、ゼロ以外のステータスで黙って終了します。
- --short - ショート
-
When showing the value of <name> as a symbolic ref, try to shorten the value, e.g. from
refs/heads/master
tomaster
.<name>の値をシンボリック参照として表示するときは、値を短くしてください(例:refs/heads/master
to)master
。 - -m
-
Update the reflog for <name> with <reason>. This is valid only when creating or updating a symbolic ref.<名前>のreflogを<理由>で更新します。これはシンボリック参照を作成または更新するときにのみ有効です。
NOTESノート
In the past, .git/HEAD
was a symbolic link pointing at
refs/heads/master
. When we wanted to switch to another branch,
we did ln -sf refs/heads/newbranch .git/HEAD
, and when we wanted
to find out which branch we are on, we did readlink .git/HEAD
.
But symbolic links are not entirely portable, so they are now
deprecated and symbolic refs (as described above) are used by
default.以前.git/HEAD
は、シンボリックリンクが指していましたrefs/heads/master
。私たちが別のブランチに切り替えたいとき、私たちはしましたln -sf refs/heads/newbranch .git/HEAD
、そして私たちがどのブランチにいるのかを知りたいとき、私たちはしましたreadlink .git/HEAD
。しかし、シンボリックリンクは完全に移植性があるわけではないので、現在は推奨されておらず、(上記のように)シンボリック参照がデフォルトで使用されています。
git symbolic-ref will exit with status 0 if the contents of the symbolic ref were printed correctly, with status 1 if the requested name is not a symbolic ref, or 128 if another error occurs.git symbolic-refは、シンボリック参照の内容が正しく印刷された場合はステータス0で終了し、要求された名前がシンボリック参照ではない場合はステータス1で終了し、別のエラーが発生した場合は128で終了します。
GIT
Part of the git[1] suite一部のgit [1]スイート
関連記事
- write-tree
- verify-pack
- update-ref
- update-index
- show-ref
- rev-parse
- rev-list
- read-tree
- merge-base
- ls-files
- hash-object
- for-each-ref
- diff-index
- count-objects
- commit-tree
- checkout-index
- check-ignore
- cat-file
- bundle
- archive
- instaweb
- filter-branch
- reflog
- fsck
- gc
- clean
- Workflows
- Tutorial
- Revisions
- gitmodules
- gitignore
- githooks
- Glossary
- Everyday Git
- gitattributes
- update-server-info
- daemon
- fast-import
- svn
- request-pull
- send-email
- format-patch
- am
- grep
- blame
- bisect
- revert
- rebase
- cherry-pick
- apply
- describe
- shortlog
- show
- submodule
- remote
- push
- pull
- fetch
- worktree
- tag
- stash
- log
- mergetool
- merge
- checkout
- branch
- mv
- rm
- reset
- commit
- diff
- status
- add
- clone
- init
- help
- config
- git
スポンサーリンク