libgit2

git_repository_set_head_detached

Version:

Make the repository HEAD directly point to the Commit.

If the provided committish cannot be found in the repository, the HEAD is unaltered and GIT_ENOTFOUND is returned.

If the provided commitish cannot be peeled into a commit, the HEAD is unaltered and -1 is returned.

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

Signature

int git_repository_set_head_detached(git_repository *repo, const git_oid *commitish, const git_signature *signature, const char *log_message);

Parameters

In
repo

Repository pointer

In
commitish

Object id of the Commit the HEAD should point to

In
signature

The identity that will used to populate the reflog entry

const char *
In
log_message

The one line long message to be appended to the reflog

Returns

int

0 on success, or an error code

Versions