LinuxCommandLibrary

git-update-ref

Safely update Git reference values

TLDR

Update ref to new value

$ git update-ref [refs/heads/branch] [commit]
copy
Delete ref
$ git update-ref -d [refs/heads/branch]
copy
Create symbolic ref
$ git update-ref --symbolic-ref [ref] [target]
copy
Update with old value check
$ git update-ref [ref] [new] [old]
copy

SYNOPSIS

git update-ref [options] ref newvalue [oldvalue]

DESCRIPTION

git update-ref safely updates ref names stored in the repository. It provides atomic ref updates with optional old value verification, ensuring that a ref is only changed if it currently points to an expected value.
This is a low-level plumbing command used internally by higher-level commands like `git branch` and `git tag`.

PARAMETERS

-d

Delete ref.
--create-reflog
Create reflog.
--no-deref
Don't dereference symbolic.
-m reason
Reflog message.
--stdin
Read from stdin.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community