update-ref
NAME名
git-update-ref - Update the object name stored in a ref safelygit-update-ref - refに格納されているオブジェクト名を安全に更新する
SYNOPSIS概要
git update-ref [-m <reason>] [--no-deref] (-d <ref> [<oldvalue>] | [--create-reflog] <ref> <newvalue> [<oldvalue>] | --stdin [-z])
DESCRIPTION説明
Given two arguments, stores the <newvalue> in the <ref>, possibly
dereferencing the symbolic refs. E.g. git update-ref HEAD
<newvalue>
updates the current branch head to the new object.2つの引数が与えられると、<newvalue>を<ref>に格納します。おそらくシンボリック参照を間接参照します。たとえばgit update-ref HEAD <newvalue>
、現在のブランチヘッドを新しいオブジェクトに更新します。
Given three arguments, stores the <newvalue> in the <ref>,
possibly dereferencing the symbolic refs, after verifying that
the current value of the <ref> matches <oldvalue>.
E.g. git update-ref refs/heads/master <newvalue> <oldvalue>
updates the master branch head to <newvalue> only if its current
value is <oldvalue>. You can specify 40 "0" or an empty string
as <oldvalue> to make sure that the ref you are creating does
not exist.3つの引数が与えられると、<ref>の現在の値が<oldvalue>と一致することを確認した後で、<ref>に<newvalue>を格納します。たとえばgit update-ref refs/heads/master <newvalue> <oldvalue>
、現在の値が<oldvalue>の場合に限り、マスターブランチヘッドを<newvalue>に更新します。<oldvalue>として40 "0"または空の文字列を指定して、作成している参照が存在しないことを確認できます。
It also allows a "ref" file to be a symbolic pointer to another ref file by starting with the four-byte header sequence of "ref:".また、 "ref:"という4バイトのヘッダーシーケンスで始まることによって、 "ref"ファイルを別のrefファイルへのシンボリックポインタにすることもできます。
More importantly, it allows the update of a ref file to follow these symbolic pointers, whether they are symlinks or these "regular file symbolic refs". It follows real symlinks only if they start with "refs/": otherwise it will just try to read them and update them as a regular file (i.e. it will allow the filesystem to follow them, but will overwrite such a symlink to somewhere else with a regular filename).さらに重要なことには、シンボリックリンクであろうと「通常のファイルシンボリック参照」であろうと、refファイルを更新してこれらのシンボリックポインタをたどることができます。実際のシンボリックリンクは "refs /"で始まっている場合にのみ従います。そうでない場合は、それらを読み込んで通常のファイルとして更新しようとします(つまり、ファイルシステムはそれらをフォローできますが、通常のファイル名)
If --no-deref is given, <ref> itself is overwritten, rather than the result of following the symbolic pointers.--no-derefが与えられると、シンボリックポインタをたどった結果ではなく、<ref>自体が上書きされます。
In general, using一般に
git update-ref HEAD "$head"
should be a lot safer than doingするよりずっと安全であるべきです
echo "$head" > "$GIT_DIR/HEAD"
both from a symlink following standpoint and an error checking standpoint. The "refs/" rule for symlinks means that symlinks that point to "outside" the tree are safe: they’ll be followed for reading but not for writing (so we’ll never write through a ref symlink to some other tree, if you have copied a whole archive by creating a symlink tree).シンボリックリンク後の観点とエラーチェックの観点の両方から。シンボリックリンクの "refs /"規則は、ツリーの「外側」を指すシンボリックリンクは安全であることを意味します。それらは読み込み用には追従されますが書き込み用には追従されません。シンボリックリンクツリーを作成してアーカイブ全体をコピーしました。
With -d
flag, it deletes the named <ref> after verifying it
still contains <oldvalue>.-d
フラグ、それはそれはまだ<OLDVALUE>含まれている検証の名にちなんで名付けられた<ref>を削除します。
With --stdin
, update-ref reads instructions from standard input and
performs all modifications together. Specify commands of the form:では--stdin
、update-refは標準入力から命令を読み取り、すべての変更をまとめて実行します。次の形式のコマンドを指定してください。
update SP <ref> SP <newvalue> [SP <oldvalue>] LF create SP <ref> SP <newvalue> LF delete SP <ref> [SP <oldvalue>] LF verify SP <ref> [SP <oldvalue>] LF option SP <opt> LF
With --create-reflog
, update-ref will create a reflog for each ref
even if one would not ordinarily be created.では--create-reflog
、update-refは、通常は作成されない場合でも、各refに対してreflogを作成します。
Quote fields containing whitespace as if they were strings in C source code; i.e., surrounded by double-quotes and with backslash escapes. Use 40 "0" characters or the empty string to specify a zero value. To specify a missing value, omit the value and its preceding SP entirely.空白を含むフィールドを、Cのソースコードの文字列であるかのように引用符で囲みます。つまり、二重引用符で囲まれ、バックスラッシュでエスケープされています。ゼロ値を指定するには、40 "0"文字または空ストリングを使用してください。欠損値を指定するには、値とその前のSPを完全に省略します。
Alternatively, use -z
to specify in NUL-terminated format, without
quoting:別の方法として、-z
引用符なしでNULで終了する形式で指定するために使用します。
update SP <ref> NUL <newvalue> NUL [<oldvalue>] NUL create SP <ref> NUL <newvalue> NUL delete SP <ref> NUL [<oldvalue>] NUL verify SP <ref> NUL [<oldvalue>] NUL option SP <opt> NUL
In this format, use 40 "0" to specify a zero value, and use the empty string to specify a missing value.この形式では、40の「0」を使用してゼロ値を指定し、空の文字列を使用して欠損値を指定します。
In either format, values can be specified in any form that Git recognizes as an object name. Commands in any other format or a repeated <ref> produce an error. Command meanings are:どちらの形式でも、Gitがオブジェクト名として認識する形式で値を指定できます。他の形式のコマンドや<ref>の繰り返しはエラーになります。コマンドの意味は次のとおりです。
- update 更新
-
Set <ref> to <newvalue> after verifying <oldvalue>, if given. Specify a zero <newvalue> to ensure the ref does not exist after the update and/or a zero <oldvalue> to make sure the ref does not exist before the update.<oldvalue>を確認した後、<ref>を<newvalue>に設定します(指定されている場合)。更新後に参照が存在しないようにするにはゼロの<newvalue>を、更新前に参照が存在しないことを確認するにはゼロの<oldvalue>を指定します。
- create つくる
-
Create <ref> with <newvalue> after verifying it does not exist. The given <newvalue> may not be zero.存在しないことを確認した後、<newvalue>を使用して<ref>を作成します。与えられた<newvalue>はゼロではないかもしれません。
- delete 削除する
-
Delete <ref> after verifying it exists with <oldvalue>, if given. If given, <oldvalue> may not be zero.指定されている場合は、<oldvalue>で存在を確認した後で<ref>を削除します。与えられた場合、<oldvalue>はゼロではないかもしれません。
- verify 確認する
-
Verify <ref> against <oldvalue> but do not change it. If <oldvalue> zero or missing, the ref must not exist.<old>に対して<ref>を確認しますが、変更しないでください。<oldvalue>がゼロまたは欠落している場合、参照は存在してはなりません。
- option オプション
-
Modify behavior of the next command naming a <ref>. The only valid option is
no-deref
to avoid dereferencing a symbolic ref.<ref>を命名する次のコマンドの動作を変更します。唯一の有効なオプションはno-deref
、シンボリック参照の間接参照を避けることです。
If all <ref>s can be locked with matching <oldvalue>s simultaneously, all modifications are performed. Otherwise, no modifications are performed. Note that while each individual <ref> is updated or deleted atomically, a concurrent reader may still see a subset of the modifications.すべての<ref>を一致する<oldvalue>で同時にロックできる場合は、すべての変更が行われます。それ以外の場合、変更は行われません。個々の<ref>は自動的に更新または削除されますが、同時読者にはまだ変更のサブセットが表示される場合があります。
LOGGING UPDATESロギングの更新
If config parameter "core.logAllRefUpdates" is true and the ref is one under
"refs/heads/", "refs/remotes/", "refs/notes/", or the symbolic ref HEAD; or
the file "$GIT_DIR/logs/<ref>" exists then git update-ref
will append
a line to the log file "$GIT_DIR/logs/<ref>" (dereferencing all
symbolic refs before creating the log name) describing the change
in ref value. Log lines are formatted as:構成パラメーター "core.logAllRefUpdates"がtrueで、参照が "refs / heads /"、 "refs / remotes /"、 "refs / notes /"、またはシンボリック参照のHEADのいずれかである場合。またはファイル "$ GIT_DIR / logs / <ref>"が存在する場合git update-ref
、ログファイル "$ GIT_DIR / logs / <ref>"に1行を追加します(ログ名を作成する前にすべてのシンボリック参照を参照解除します)。 。ログ行は次のようにフォーマットされています。
oldsha1 SP newsha1 SP committer LF
Where "oldsha1" is the 40 character hexadecimal value previously stored in <ref>, "newsha1" is the 40 character hexadecimal value of <newvalue> and "committer" is the committer’s name, email address and date in the standard Git committer ident format.ここで、 "oldsha1"は以前に<ref>に格納されていた40文字の16進値で、 "newsha1"は<newvalue>の40文字の16進値で、 "committer"は標準GitコミッターID形式のコミッターの名前、Eメールアドレスおよび日付です。 。
Optionally with -m:オプションで-mと一緒に:
oldsha1 SP newsha1 SP committer TAB message LF
Where all fields are as described above and "message" is the value supplied to the -m option.すべてのフィールドは上記のとおりで、「message」は-mオプションに指定された値です。
An update will fail (without changing <ref>) if the current user is unable to create a new log file, append to the existing log file or does not have committer information available.現在のユーザが新しいログファイルを作成できない、既存のログファイルに追加できない、または利用可能なコミッタ情報がない場合、更新は(<ref>を変更せずに)失敗します。
GIT
Part of the git[1] suite一部のgit [1]スイート
関連記事
- write-tree
- verify-pack
- update-index
- symbolic-ref
- 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
スポンサーリンク