libgit2

git_branch_move

Version:

Move/rename an existing branch reference.

Signature

int git_branch_move(git_repository *repo, const char *old_branch_name, const char *new_branch_name, int force);

Parameters

In
repo

Repository where lives the branch.

const char *
In
old_branch_name

Current name of the branch to be moved; this name is validated for consistency.

const char *
In
new_branch_name

Target name of the branch once the move is performed; this name is validated for consistency.

int
In
force

Overwrite existing branch.

Returns

int

0 on success, GIT_ENOTFOUND if the branch doesn't exist or an error code.

Versions