Class branch

Class Documentation

class branch

Represents a Git branch and common branch operations.

Public Functions

std::vector<std::string> ShowExistBranch()

List all branches in the repository.

std::vector<commit> ShowExistCommitsOnBranch(const std::string &branchName)

Get commits that exist on the given branch.

bool SetBranch(const std::string &branchName)

Switch to the specified branch.

bool MakeNewFromHEAD(const std::string &newBranchName)
bool MakeNewFromCommit(commit &c, const std::string &newBranchName)
bool DeleteBranch(const std::string &branchName)
bool CheckoutThisHEAD()
bool CheckoutCommitTemp(commit &c)
std::optional<commit> GetHEAD()

Retrieve the current HEAD commit.

bool MergeToBranch(const std::string &branchToMerge)
inline branch(git_repository *repo)
~branch()
template<>
std::string ToBranchRefName(const std::string &branchName)
template<>
std::string ToBranchRefName(const char *branchName)

Public Members

std::string branchName

Name of the current branch.

std::optional<git_oid> FLAG_TEMP_CHECKOUT

Temporary checkout commit used when jumping to a commit.

Public Static Functions

template<typename T>
static std::string ToBranchRefName(T branchName)

Convert a name to a Git branch reference.