libgit2

git_branch_set_upstream

Version:

Set a branch's upstream branch

This will update the configuration to set the branch named branch_name as the upstream of branch. Pass a NULL name to unset the upstream information.

Notes

  • the actual tracking reference must have been already created for the operation to succeed.

Signature

int git_branch_set_upstream(git_reference *branch, const char *branch_name);

Parameters

In
branch

the branch to configure

const char *
In
branch_name

remote-tracking or local branch to set as upstream.

Returns

int

0 on success; GIT_ENOTFOUND if there's no branch named branch_name or an error code

Versions