reflog¶

For git-reflog(1).

Overview¶

Manage git reflog using GitReflogManager (collection-level) and GitReflogEntryCmd (per-entry operations).

Examples¶

List reflog entries and look one up by refspec:

>>> from libvcs.cmd.git import Git
>>> git = Git(path=example_git_repo.path)
>>> entries = git.reflog.ls()
>>> len(entries) >= 1
True
>>> entry = git.reflog.get(refspec='HEAD@{0}')
>>> entry.refspec
'HEAD@{0}'

Check whether a ref has a reflog:

>>> from libvcs.cmd.git import Git
>>> git = Git(path=example_git_repo.path)
>>> git.reflog.exists('HEAD')
True

Expire old reflog entries:

>>> from libvcs.cmd.git import Git
>>> git = Git(path=example_git_repo.path)
>>> git.reflog.expire(expire='90.days.ago')
''

API Reference¶

class libvcs.cmd.git.GitReflogManager
¶
class libvcs.cmd.git.GitReflogManager
¶

Bases: object

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

class libvcs.cmd.git.GitReflogEntryCmd
¶
class libvcs.cmd.git.GitReflogEntryCmd
¶

Bases: object

Run git commands targeting a specific reflog entry.

class libvcs.cmd.git.GitReflogEntry
¶
class libvcs.cmd.git.GitReflogEntry
¶

Bases: object

Represent a git reflog entry.