libgit2

git_repository_detach_head

Version:

Detach the HEAD.

If the HEAD is already detached and points to a Commit, 0 is returned.

If the HEAD is already detached and points to a Tag, the HEAD is updated into making it point to the peeled Commit, and 0 is returned.

If the HEAD is already detached and points to a non commitish, the HEAD is unaltered, and -1 is returned.

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

Signature

int git_repository_detach_head(git_repository *repo, const git_signature *signature, const char *reflog_message);

Parameters

In
repo

Repository pointer

In
signature

The identity that will used to populate the reflog entry

const char *
In
reflog_message

The one line long message to be appended to the reflog

Returns

int

0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing branch or an error code

Versions