tag

For git-tag(1).

Overview

Manage git tags using GitTagManager (collection-level) and GitTagCmd (per-tag operations).

Examples

Create a tag, then list tags — optionally narrowed to a pattern:

>>> from libvcs.cmd.git import Git
>>> git = Git(path=example_git_repo.path)
>>> git.tags.create(name='v1.0.0', message='Release 1.0.0')
''
>>> tags = git.tags.ls()
>>> len(tags) >= 1
True
>>> release_tags = git.tags.ls(pattern='v*')
>>> release_tags[0].tag_name
'v1.0.0'

Get a specific tag and operate on it through its Cmd object:

>>> from libvcs.cmd.git import Git
>>> git = Git(path=example_git_repo.path)
>>> git.tags.create(name='v2.0.0', message='Release 2.0.0')
''
>>> tag = git.tags.get(tag_name='v2.0.0')
>>> tag.show()
'tag v2.0.0...'
>>> tag.delete()
"Deleted tag 'v2.0.0' ..."

API Reference

class libvcs.cmd.git.GitTagManager
class libvcs.cmd.git.GitTagManager

Bases: object

Traverse git tags with QueryList.

class libvcs.cmd.git.GitTagCmd
class libvcs.cmd.git.GitTagCmd

Bases: object

Run git commands targeting a specific tag.