Contents
Return a list with all the references in the repository.
Lookup a reference by its name in a repository.
Example:
>>> all_refs = repo.listall_references()
>>> master_ref = repo.lookup_reference("refs/heads/master")
>>> commit = master_ref.get_object() # or repo[master_ref.target]
The full name of the reference.
The shorthand “human-readable” name of the reference.
The reference target: If direct the value will be an Oid object, if it is symbolic it will be an string with the full name of the target reference.
Type, either GIT_REF_OID or GIT_REF_SYMBOLIC.
Delete this reference. It will no longer be valid!
Rename the reference.
Resolve a symbolic reference and return a direct reference.
Retrieves the current reference log.
Append a reflog entry to the reference. If the oid is None then keep the current reference’s oid. The message parameter may be None.
Retrieves the object the current reference is pointing to.
Example. These two lines are equivalent:
>>> head = repo.lookup_reference('HEAD').resolve()
>>> head = repo.head
Current head reference of the repository.
A repository’s HEAD is detached when it points directly to a commit instead of a branch.
An unborn branch is one named from HEAD but which doesn’t exist in the refs namespace, because it doesn’t have any commit to point to.
Branches inherit from References, and additionally provide spetialized accessors for some unique features.
Return a tuple with all the branches in the repository.
Returns the Git reference for the given branch name (local or remote).
Create a new branch “name” which points to a commit.
Arguments:
Examples:
repo.create_branch('foo', repo.head.hex, force=False)
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)
The name of the local or remote branch.
The name of the remote that the remote tracking branch belongs to.
The branch supporting the remote tracking branch or None if this is not a remote tracking branch. Set to None to unset.
The name of the reference supporting the remote tracking branch.
Move/rename an existing local branch reference. The new branch name will be checked for validity. Returns the new branch.
Delete this branch. It will no longer be valid!
True if HEAD points at the branch, False otherwise.
Example:
>>> head = repo.lookup_reference('refs/heads/master')
>>> for entry in head.log():
... print(entry.message)
New oid.
Old oid.
Message.
Committer.
Create a new note for an object, return its SHA-ID.If no ref is given ‘refs/notes/commits’ will be used.
Lookup a note for an annotated object in a repository.