Skip to main content

Pretty-print `git` repository collaborators sorted by contributions

Project description

Pretty-print git repository collaborators sorted by contributions.

PyPI-Versions PyPI-Status Docker Snapcraft

Build-Status Coverage-Status Branch-Coverage-Status Codacy-Grade Libraries-Rank PyPI-Downloads

DOI-URI LICENCE OpenHub-Status Gift-Casper

~$ git fame
Blame: 100%|██████████| 20/20 [00:00<00:00, 175.94file/s]
Total commits: 99
Total files: 21
Total loc: 305
| Author               |   loc |   coms |   fils |  distribution   |
|:---------------------|------:|-------:|-------:|:----------------|
| Casper da Costa-Luis |   304 |     97 |     20 | 99.7/98.0/95.2  |
| Igor Gnatenko        |     1 |      1 |      1 | 0.3/ 1.0/ 4.8   |
| Johann Mortara       |     0 |      1 |      0 | 0.0/ 1.0/ 0.0   |

The distribution column is a percentage breakdown of the other columns (e.g. in the table above, Casper has written surviving code in 20/21 = 95.2% of all files).


Installation

Latest PyPI stable release

PyPI-Status PyPI-Downloads Libraries-Dependents

pip install git-fame

Latest development release on GitHub

GitHub-Status GitHub-Stars GitHub-Commits GitHub-Forks GitHub-Updated

Pull and install in the current directory:

pip install -e git+https://github.com/casperdcl/git-fame.git@master#egg=git-fame

Latest Snapcraft release

Snapcraft

snap install git-fame

Latest Docker release

Docker

docker pull casperdcl/git-fame
docker run --rm casperdcl/git-fame --help
docker run --rm -v </local/path/to/repository>:/repo casperdcl/git-fame

Register alias with git

This is probably not necessary on UNIX systems.

git config --global alias.fame "!python -m gitfame"

Tab completion

Optionally, systems with bash-completion can install tab completion support. The git-fame_completion.bash file needs to be copied to an appropriate folder.

On Ubuntu, the procedure would be:

$ # Ensure completion works for `git` itself
$ sudo apt-get install bash-completion

$ # Install `git fame` completions
$ sudo wget \
    https://raw.githubusercontent.com/casperdcl/git-fame/master/git-fame_completion.bash \
    -O /etc/bash_completion.d/git-fame_completion.bash

followed by a terminal restart.

Changelog

The list of all changes is available either on GitHub’s Releases: GitHub-Status or on crawlers such as allmychanges.com.

Usage

git fame              # If alias registered with git (see above)
git-fame              # Alternative execution as python console script
python -m gitfame     # Alternative execution as python module
git-fame -h           # Print help

For example, to print statistics regarding all source files in a C++/CUDA repository (*.c/h/t(pp), *.cu(h)), carefully handling whitespace and line copies:

git fame --incl '\.[cht][puh]{0,2}$' -twMC

It is also possible to run from within a python shell or script.

>>> import gitfame
>>> gitfame.main(['--sort=commits', '-wt', '/path/to/my/repo'])

Documentation

PyPI-Versions README-Hits

Usage:
  gitfame [--help | options] [<gitdir>]

Arguments:
  <gitdir>       Git directory [default: ./].

Options:
  -h, --help     Print this help and exit.
  -v, --version  Print module version and exit.
  --branch=<b>   Branch or tag [default: HEAD] up to which to check.
  --sort=<key>   [default: loc]|commits|files|hours|months.
  --excl=<f>     Excluded files (default: None).
                 In no-regex mode, may be a comma-separated list.
                 Escape (\,) for a literal comma (may require \\, in shell).
  --incl=<f>     Included files [default: .*]. See `--excl` for format.
  --since=<date>  Date from which to check. Can be absoulte (eg: 1970-01-31)
                  or relative to now (eg: 3.weeks).
  --cost=<method>  Include time cost in person-months (COCOMO) or
                   person-hours (based on commit times).
                   Methods: month(s)|cocomo|hour(s)|commit(s).
                   May be multiple comma-separated values.
  -n, --no-regex  Assume <f> are comma-separated exact matches
                  rather than regular expressions [default: False].
                  NB: if regex is enabled `,` is equivalent to `|`.
  -s, --silent-progress    Suppress `tqdm` [default: False].
  --warn-binary   Don't silently skip files which appear to be binary data
                  [default: False].
  -t, --bytype             Show stats per file extension [default: False].
  -w, --ignore-whitespace  Ignore whitespace when comparing the parent's
                           version and the child's to find where the lines
                           came from [default: False].
  -M  Detect intra-file line moves and copies [default: False].
  -C  Detect inter-file line moves and copies [default: False].
  --format=<format>        Table format
      [default: pipe]|md|markdown|yaml|yml|json|csv|tsv|tabulate.
      May require `git-fame[<format>]`, e.g. `pip install git-fame[yaml]`.
      Any `tabulate.tabulate_formats` is also accepted.
  --manpath=<path>         Directory in which to install git-fame man pages.
  --log=<lvl>     FATAL|CRITICAL|ERROR|WARN(ING)|[default: INFO]|DEBUG|NOTSET.

If multiple user names and/or emails correspond to the same user, aggregate git-fame statistics and maintain a git repository properly by adding a [.mailmap file](https://git-scm.com/docs/git-blame#_mapping_authors).

Contributions

GitHub-Commits GitHub-Issues GitHub-PRs OpenHub-Status

All source code is hosted on GitHub. Contributions are welcome.

LICENCE

Open Source (OSI approved): LICENCE

Citation information: DOI-URI

Authors

OpenHub-Status

We are grateful for all GitHub-Contributions.

README-Hits

Project details


Download files

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

Files for git-fame, version 1.9.0
Filename, size File type Python version Upload date Hashes
Filename, size git_fame-1.9.0-py2.py3-none-any.whl (16.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size git-fame-1.9.0.tar.gz (22.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page