libgit2

git_reset_from_annotated

Version:

Sets the current head to the specified commit oid and optionally resets the index and working tree to match.

This behaves like git_reset() but takes an annotated commit, which lets you specify which extended sha syntax string was specified by a user, allowing for more exact reflog messages.

See the documentation for git_reset().

Signature

int git_reset_from_annotated(git_repository *repo, const git_annotated_commit *target, git_reset_t reset_type, const git_checkout_options *checkout_opts);

Parameters

In
repo

Repository where to perform the reset operation.

In
target

Annotated commit to which the Head should be moved to. This object must belong to the given repo, it will be dereferenced to a git_commit which oid will be used as the target of the branch.

In
reset_type

Kind of reset operation to perform.

In
checkout_opts

Optional checkout options to be used for a HARD reset. The checkout_strategy field will be overridden (based on reset_type). This parameter can be used to propagate notify and progress callbacks.

Returns

int

0 on success or an error code

Versions