Pretty-print `git` repository collaborators sorted by contributions


Keywords
git, blame, git-blame, git-log, code-analysis, cost, loc, author, commit, shortlog, ls-files
License
MPL-2.0
Install
pip install git-fame==1.1.0

Documentation

git-fame

Pretty-print git repository collaborators sorted by contributions.

Py-Versions PyPI Conda-Forge Docker Snapcraft

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

DOI-URI LICENCE OpenHub-Status Sponsor-Casper

The distribution column is a percentage breakdown of loc/coms/fils. (e.g. in the table above, Casper has written surviving code in 172/461 = 37.3% of all files).


Table of contents

Installation

Latest PyPI stable release

PyPI PyPI-Downloads Libraries-Dependents

Latest development release on GitHub

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

Pull and install:

Latest Conda release

Conda-Forge

Latest Snapcraft release

Snapcraft

Latest Docker release

Docker

Register alias with git

On Windows, run:

This is probably not necessary on UNIX systems. If git fame doesn't work after restarting the terminal on Linux & Mac OS, try (with single quotes):

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:

followed by a terminal restart.

Changelog

The list of all changes is available on the Releases page: GitHub-Status.

Usage

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:

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

Documentation

Py-Versions

Usage:
  git-fame [--help | options] [<gitdir>...]

Arguments:
  <gitdir>       Git directory [default: ./].
                 May be specified multiple times to aggregate across
                 multiple repositories.

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.
  --loc=<type>   surv(iving)|ins(ertions)|del(etions)
                 What `loc` represents. Use 'ins,del' to count both.
                 defaults to 'surviving' unless `--cost` is specified.
  --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.
                   Alters `--loc` default to imply 'ins' (COCOMO) or
                   'ins,del' (hours).
  -R, --recurse  Recursively find repositories & submodules within <gitdir>.
  -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].
  -e, --show-email  Show author email instead of name [default: False].
  --enum         Show row numbers [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].
  --ignore-rev=<rev>       Ignore changes made by the given revision
                           (requires `--loc=surviving`).
  --ignore-revs-file=<f>   Ignore revisions listed in the given file
                           (requires `--loc=surviving`).
  --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.

FAQs

Options such as -w, -M, and -C can increase accuracy, but take longer to compute.

Note that specifying --sort=hours or --sort=months requires --cost to be specified appropriately.

Note that --cost=months (--cost=COCOMO) approximates person-months and should be used with --loc=ins.

Meanwhile, --cost=hours (--cost=commits) approximates person-hours.

Extra care should be taken when using ins and/or del for --loc since all historical files (including those no longer surviving) are counted. In such cases, --excl may need to be significantly extended. On the plus side, it is faster to compute ins and del compared to surv.

Examples

CODEOWNERS

Generating CODEOWNERS:

Zenodo config

Generating .zenodo.json:

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.