deb-python-pygit2/docs/recipes/git-show.rst
2013-07-05 20:14:33 -04:00

50 lines
1.5 KiB
ReStructuredText

**********************************************************************
git-show
**********************************************************************
----------------------------------------------------------------------
Showing a commit
----------------------------------------------------------------------
.. code-block:: bash
$> git show d370f56
.. code-block:: python
>>> repo = pygit2.Repository('/path/to/repository')
>>> commit = repo.revparse_single('d370f56')
======================================================================
Show log message
======================================================================
>>> message = commit.message
======================================================================
Show SHA hash
======================================================================
>>> hash = commit.hex
======================================================================
Show diff
======================================================================
>>> diff = commit.tree.diff()
======================================================================
Show all files in commit
======================================================================
>>> for e in commit.tree:
>>> print(e.name)
----------------------------------------------------------------------
References
----------------------------------------------------------------------
- git-show_.
.. _git-show: https://www.kernel.org/pub/software/scm/git/docs/git-show.html