class Git::Branch

Represents a Git branch

Branch objects provide access to branch metadata and operations like checkout, delete, and merge. They should be obtained via {Git::Repository#branch} or {Git::Repository#branches}, not constructed directly.

@example Getting a branch

git = Git.open('.')
branch = git.branch('main')
branch.checkout

@example Listing branches

git.branches.each { |b| puts b.name }

@deprecated Use {Git::Repository::Branching#branch_list} and the

name-based branch operations on {Git::Repository} instead

{Git::Repository::Branching#branch_list} returns immutable
{Git::BranchInfo} value objects. Operations that lived on this class are
called on the repository with the branch name instead (for example
{Git::Repository::Branching#checkout} and
{Git::Repository::Branching#branch_delete}). Every operation on a
`Git::Branch` emits a deprecation warning; the `full`, `name`, `remote`,
`to_s`, and `to_a` readers do not.

@api public