Home Explore Blog CI



git

2nd chunk of `Documentation/git-update-ref.adoc`
054dc30855a3016d706e2d7ec7ce40f0a1915a85cff8eb1b0000000100000965
 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.

Alternatively, use `-z` to specify in NUL-terminated format, without
quoting:

	update SP <ref> NUL <new-oid> NUL [<old-oid>] NUL
	create SP <ref> NUL <new-oid> NUL
	delete SP <ref> NUL [<old-oid>] NUL
	verify SP <ref> NUL [<old-oid>] NUL
	symref-update SP <ref> NUL <new-target> [NUL (ref NUL <old-target> | oid NUL <old-oid>)] NUL
	symref-create SP <ref> NUL <new-target> NUL
	symref-delete SP <ref> [NUL <old-target>] NUL
	symref-verify SP <ref> [NUL <old-target>] NUL
	option SP <opt> NUL
	start NUL
	prepare NUL
	commit NUL
	abort NUL

In this format, use 40 "0" to specify a zero value, and use the empty
string to specify a missing value.

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:

update::
	Set <ref> to <new-oid> after verifying <old-oid>, if given.
	Specify a zero <new-oid> to ensure the ref does not exist
	after the update and/or a zero <old-oid> to make sure the
	ref does not exist before the update.

create::
	Create <ref> with <new-oid> after verifying that it does not
	exist.  The given <new-oid> may not be zero.

delete::
	Delete <ref> after verifying that it exists with <old-oid>, if
	given.  If given, <old-oid> may not be zero.

symref-update::
	Set <ref> to <new-target> after verifying <old-target> or <old-oid>,
	if given. Specify a zero <old-oid> to ensure that the ref does not
	exist before the update.

verify::
	Verify <ref> against <old-oid> but do not change it.  If
	<old-oid> is zero or missing, the ref must not exist.

symref-create:
	Create symbolic ref <ref> with <new-target> after verifying that
	it does not exist.

symref-delete::
	Delete <ref> after verifying that it exists with <old-target>, if given.

symref-verify::
	Verify symbolic <ref> against <old-target> but do not change it.
	If <old-target> is missing, the ref must not exist.  Can only be
	used in `no-deref` mode.

option::
	Modify the behavior of the next command naming a <ref>.
	The only valid option is `no-deref` to avoid dereferencing
	a symbolic ref.

start::
	Start a transaction. In contrast to a non-transactional session, a
	transaction will automatically abort if the session

Title: Git Update Ref Command Options and Formats
Summary
The git update-ref command supports various options and formats for updating references, including quoting with backslash escapes, NUL-terminated format, and specifying zero or missing values. It also provides several commands, such as update, create, delete, verify, and symref-update, each with its own set of options and behaviors, allowing for flexible and safe management of references in a Git repository.