1cc112c32f
It seems I have been forgetting to update the documentation with the last few changes, so adjust to the oid -> id renaming and add missing attributes to the listings.
44 lines
1.2 KiB
ReStructuredText
44 lines
1.2 KiB
ReStructuredText
**********************************************************************
|
|
git-log
|
|
**********************************************************************
|
|
|
|
----------------------------------------------------------------------
|
|
Showing HEAD commit logs
|
|
----------------------------------------------------------------------
|
|
|
|
======================================================================
|
|
Show HEAD commit
|
|
======================================================================
|
|
|
|
.. code-block:: bash
|
|
|
|
$> git log -1
|
|
|
|
.. code-block:: python
|
|
|
|
>>> commit = repo[repo.head.target]
|
|
>>> commit.message
|
|
'commit message'
|
|
|
|
======================================================================
|
|
Traverse commit history
|
|
======================================================================
|
|
|
|
.. code-block:: bash
|
|
|
|
$> git log
|
|
|
|
.. code-block:: python
|
|
|
|
>>> last = repo[repo.head.target]
|
|
>>> for commit in repo.walk(last.id, pygit2.GIT_SORT_TIME):
|
|
>>> print(commit.message) # or some other operation
|
|
|
|
----------------------------------------------------------------------
|
|
References
|
|
----------------------------------------------------------------------
|
|
|
|
- git-log_.
|
|
|
|
.. _git-log: https://www.kernel.org/pub/software/scm/git/docs/git-log.html
|