libgit2

git_reference_set_target

Version:

Create a new reference with the same name as the given reference but a different OID target. The reference must be a direct reference, otherwise this will fail.

The new reference will be written to disk, overwriting the given reference.

Signature

int git_reference_set_target(git_reference **out, git_reference *ref, const git_oid *id);

Parameters

In
out

Pointer to the newly created reference

In
ref

The reference

In
id

The new target OID for the reference

Returns

int

0 or an error code

Versions