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 committish, 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);

Parameters

In
repo

Repository pointer

Returns

int

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

Versions