branch¶

For git-branch(1).

Overview¶

Manage git branches using GitBranchManager (collection-level) and GitBranchCmd (per-branch operations).

Example¶

from libvcs.cmd.git import Git

git = Git(path='/path/to/repo')

# List all branches
branches = git.branches.ls()

# List remote branches only
remote_branches = git.branches.ls(remotes=True)

# Create a new branch
git.branches.create('feature-branch')

# Get a specific branch and operate on it
branch = git.branches.get(branch_name='feature-branch')
branch.rename('new-feature')
branch.delete()

API Reference¶

class libvcs.cmd.git.GitBranchManager
¶

Bases: object

Traverse and manage git branches with ORM-like filtering via QueryList.

class libvcs.cmd.git.GitBranchCmd
¶

Bases: object

Run git commands targeting a specific branch.