libgit2

git_branch_upstream_name

Version:

Get the upstream name of a branch

Given a local branch, this will return its remote-tracking branch information, as a full reference name, ie. "feature/nice" would become "refs/remote/origin/feature/nice", depending on that branch's configuration.

Signature

int git_branch_upstream_name(git_buf *out, git_repository *repo, const char *refname);

Parameters

In
out

the buffer into which the name will be written.

In
repo

the repository where the branches live.

const char *
In
refname

reference name of the local branch.

Returns

int

0 on success, GIT_ENOTFOUND when no remote tracking reference exists, or an error code.

Versions