git_checkout_head

Updates files in the index and the working tree to match the content of the commit pointed at by HEAD.

Note that this is _not_ the correct mechanism used to switch branches; do not change your HEAD and then call this method, that would leave you with checkout conflicts since your working directory would then appear to be dirty. Instead, checkout the target of the branch and then update HEAD using git_repository_set_head to point to the branch you checked out.

extern (C) nothrow @nogc
int
git_checkout_head

Parameters

repo libgit2_d.types.git_repository*

repository to check out (must be non-bare)

opts const(.git_checkout_options)*

specifies checkout options (may be null)

Return Value

Type: int

0 on success, git_error_code.GIT_EUNBORNBRANCH if HEAD points to a non existing branch, non-zero value returned by notify_cb, or other error code < 0 (use git_error_last for error details)

Meta