libgit2

git_branch_create_from_annotated

Version:

Create a new branch pointing at a target commit

This behaves like git_branch_create() 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.

Signature

int git_branch_create_from_annotated(git_reference **ref_out, git_repository *repo, const char *branch_name, const git_annotated_commit *target, int force);

Parameters

In
ref_out

Pointer where to store the underlying reference.

In
repo

the repository to create the branch in.

const char *
In
branch_name

Name for the branch; this name is validated for consistency. It should also not conflict with an already existing branch name.

In
target

Annotated commit to which this branch should point. This object must belong to the given repo.

int
In
force

Overwrite existing branch.

Returns

int

0, GIT_EINVALIDSPEC or an error code.

Versions