git_repository_set_head

Make the repository HEAD point to the specified reference.

If the provided reference points to a Tree or a Blob, the HEAD is unaltered and -1 is returned.

If the provided reference points to a branch, the HEAD will point to that branch, staying attached, or become attached if it isn't yet. If the branch doesn't exist yet, no error will be return. The HEAD will then be attached to an unborn branch.

Otherwise, the HEAD will be detached and will directly point to the Commit.

extern (C) nothrow @nogc
int
git_repository_set_head

Parameters

repo libgit2_d.types.git_repository*

Repository pointer

refname const(char)*

Canonical name of the reference the HEAD should point at

Return Value

Type: int

0 on success, or an error code

Meta