libvcs.cmd.gitΒΆ

For git(1).

Compare to: fabtools.git, salt.modules.git, ansible.builtin.git

Managers and CommandsΒΆ

libvcs provides Managers and Commands for git subcommands:

  • Managers (git.branches, git.tags, etc.) let you traverse repository entities intuitively with ORM-like filtering via QueryList

  • Commands are contextual ways to run git commands against a specific target entity

Git instance
β”œβ”€β”€ branches: GitBranchManager
β”‚   β”œβ”€β”€ ls() -> QueryList[GitBranchCmd]
β”‚   β”œβ”€β”€ get() -> GitBranchCmd
β”‚   └── create()
β”œβ”€β”€ tags: GitTagManager
β”œβ”€β”€ remotes: GitRemoteManager
β”œβ”€β”€ stashes: GitStashManager
β”œβ”€β”€ worktrees: GitWorktreeManager
β”œβ”€β”€ notes: GitNotesManager
β”œβ”€β”€ submodules: GitSubmoduleManager
└── reflog: GitReflogManager

Quick ExampleΒΆ

from libvcs.cmd.git import Git

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

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

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

# Get a specific branch and rename it
branch = git.branches.get(branch_name='old-name')
branch.rename('new-name')

# Create and manage tags
git.tags.create(name='v1.0.0', message='Release 1.0')
tag = git.tags.get(tag_name='v1.0.0')
tag.delete()

Run git commands directly against a local git repo.

class libvcs.cmd.git.Git
ΒΆ

Bases: object

Run commands directly on a git repository.