diff --git a/docs/references.rst b/docs/references.rst index 6ede2a712..cccd68aa1 100644 --- a/docs/references.rst +++ b/docs/references.rst @@ -27,6 +27,23 @@ The Reference type .. automethod:: pygit2.Reference.resolve .. automethod:: pygit2.Reference.log .. automethod:: pygit2.Reference.log_append + + Example:: + + >>> branch = repository.lookup_reference("refs/heads/master") + >>> branch.target = another_commit.id + >>> committer = Signature('Cecil Committer', 'cecil@committers.tld') + >>> branch.log_append(another_commit.id, committer, + "changed branch target using pygit2") + + This creates a reflog entry in ``git reflog master`` which looks like:: + + 7296b92 master@{10}: changed branch target using pygit2 + + In order to make an entry in ``git reflog``, ie. the reflog for ``HEAD``, you + have to get the Reference object for ``HEAD`` and call ``log_append`` on + that. + .. automethod:: pygit2.Reference.get_object