Skip to main content

print a one-line summary of the current git repository, the current branch, and the hash for the current branch head

Project description

gitsummary

Pure python utility to print a one-line summary of the current git repository, the current branch, and the hash for the current head.

Installation

pip install gitsummary

or

conda -c conda-forge install gitsummary

Usage

>>> import gitsummary
>>> gitsummary.print_cwd_git_version()
'some_git_repository:On branch main at rev cd813e5'

returns a string containing the current git repository, the current branch, and the hash of the branch head. This information is useful in scientific codes to quickly determine the origin of a plot or dataset. The string can, for example, be written in a jupyter notebook or placed in the metadata of a netcdf file.

some_git_repository is reported as final portion of the URL of the remote 'origin'. If there is no remote named origin, it uses the full path on disk to the .git directory.

License

This project is licensed under the terms of the MIT license.

Credits

Adapted by Timothy W. Hilton from code originally written by Travis O'Brien.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gitsummary-0.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

gitsummary-0.2-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page