Metadata-Version: 2.4
Name: gitsummary
Version: 0.3.5
Summary: print a one-line summary of the current git repository, the current branch, and the hash for the current branch head
License: MIT
Project-URL: Homepage, https://github.com/Timothy-W-Hilton/gitsummary
Project-URL: Bug Tracker, https://github.com/Timothy-W-Hilton/gitsummary/issues
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: GitPython
Dynamic: license-file

## 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

``` shell
pip install gitsummary
```
or
``` shell
conda -c conda-forge install gitsummary
```

### Usage

``` python
>>> import gitsummary
>>> gitsummary.print_cwd_git_version()
'some_git_repository:On branch main at rev cd813e5 (working tree clean)'
>>> gitsummary.print_cwd_git_version(print_timestamp=True)
'19 Mar 2026 11:40:47 some_git_repository:On branch main at rev cd813e5 (working tree clean)'
```

Returns a string containing the current git repository, the current branch, the hash of the branch head, and whether the working tree has unstaged changes to tracked files. 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](https://jupyter.org/) or placed in the metadata of a [netcdf](https://www.unidata.ucar.edu/software/netcdf/) file.

`some_git_repository` is reported as the 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.

Setting `print_timestamp=True` prepends the current system time to the output.

### Testing

Tests are managed with [nox](https://nox.thea.codes/). To run the test suite:

``` shell
pip install nox
nox -p 3.12
```

## License

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

## Credits

Adapted by [Timothy W. Hilton](https://github.com/Timothy-W-Hilton) from code originally written by [Travis O'Brien](https://github.com/taobrienlbl).


