Update Object Name in Reference

suggest change

Use

Update the object name which is stored in reference

SYNOPSIS

git update-ref [-m <reason>] (-d <ref> [<oldvalue>] | [--no-deref] [--create-reflog] <ref> <newvalue> [<oldvalue>] | --stdin [-z])

General Syntax

  1. Follow a symbolic ref. This moves the current branch to the new object:
git update-ref HEAD <newvalue>
  1. Store newvalue in ref only if the current value matches oldvalue.
git update-ref refs/heads/master <newvalue> <oldvalue>

That updates master only when it still points at oldvalue.

-d deletes <ref> after verifying that it still contains <oldvalue>.

--create-reflog writes a reflog for the ref even when Git would not ordinarily create one.

-z makes --stdin use NUL-terminated records. Those commands are update, create, delete, and verify.

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.

Create

Create <ref> with <newvalue> after verifying it does not exist. The given <newvalue> may not be zero.

Delete

Delete <ref> after verifying it exists with <oldvalue>, if given. If given, <oldvalue> may not be zero.

Verify

Verify <ref> against <oldvalue> but do not change it. If <oldvalue> is zero or missing, the ref must not exist.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents