git_branch_create

Create a new branch pointing at a target commit

A new direct reference will be created pointing to this target commit. If force is true and a reference already exists with the given name, it'll be replaced.

The returned reference must be freed by the user.

The branch name will be checked for validity. See git_tag_create() for rules about valid names.

extern (C) nothrow @nogc
int
git_branch_create

Parameters

out_ libgit2_d.types.git_reference**

Pointer where to store the underlying reference.

branch_name const(char)*

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

target const(libgit2_d.types.git_commit)*

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

force int

Overwrite existing branch.

Return Value

Type: int

0, git_error_code.GIT_EINVALIDSPEC or an error code. A proper reference is written in the refs/heads namespace pointing to the provided target commit.

Meta