Contents
Example:
>>> all_refs = repo.listall_references()
>>> master_ref = repo.lookup_reference("refs/heads/master")
>>> commit = master_ref.get_object() # or repo[master_ref.target]
Example. These two lines are equivalent:
>>> head = repo.lookup_reference('HEAD').resolve()
>>> head = repo.head
Branches inherit from References, and additionally provide spetialized accessors for some unique features.
Example:
>>> local_branches = repo.listall_branches()
>>> # equivalent to
>>> local_branches = repo.listall_branches(pygit2.GIT_BRANCH_LOCAL)
>>> remote_branches = repo.listall_branches(pygit2.GIT_BRANCH_REMOTE)
>>> all_branches = repo.listall_branches(pygit2.GIT_BRANCH_REMOTE |
pygit2.GIT_BRANCH_LOCAL)
>>> master_branch = repo.lookup_branch('master')
>>> # equivalent to
>>> master_branch = repo.lookup_branch('master',
pygit2.GIT_BRANCH_LOCAL)
>>> remote_branch = repo.lookup_branch('upstream/feature',
pygit2.GIT_BRANCH_REMOTE)
Example:
>>> head = repo.lookup_reference('refs/heads/master')
>>> for entry in head.log():
... print(entry.message)